Compiler errors C++;scanf未在此范围内声明

Compiler errors C++;scanf未在此范围内声明,compiler-errors,scanf,stdio,Compiler Errors,Scanf,Stdio,这是我的密码 #include <iostream> #include <stdio.h> using namespace std; int main() { long long int N = 0, product, sum; int t; scanf_s("%d", &t); //// ERROR STARTS AT THIS LINE while (t--) { sum = 0; sca

这是我的密码

#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    long long int N = 0, product, sum;
    int t; scanf_s("%d", &t);  //// ERROR STARTS AT THIS LINE
    while (t--)
    {
        sum = 0;

        scanf_s("%d", &N);
        N = N / 2;

        product = 1;
        sum = 1; 
        for (int i = 1; i <= N; i++)
        {
            product = product * i;
            sum += product;
        }

        printf("%d \n", sum);
    }
    return 0;
}
我试过用
C++(gcc-4.3.2)
(C++gcc-4.9.2)
C++14(g++4.9.2)
进行编译,但都没有成功。 为什么?我已经包括了

你可以改变
scanf\u s
scanf

添加

#include <cstdio>

而不是
sscanf

scanf\u s
是微软特有的。谢谢!这很有帮助!!:DDD
#include <cstdio>
std::sscanf