error C3861: “gets”: 找不到标识符

请帮我看一下为怎么报错: error C3861: “gets”: 找不到标识符

img


代码:#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;



int main ()

{

char str[100];

int alpha=0,digit=0,space=0,other=0;

int n=100;

gets(str); //字符串的输入 

for(int i=0;i<strlen(str);i++)

{

if (isalpha(str[i]))

++alpha;

else if(isdigit(str[i]))

++digit;

else if(str[i]==32)

++space;

else

++other;

}

cout<<alpha<<" "<<digit<<" "<<space<<" "<<other<<endl;

return 0;

 } 

改用gets_s ()

gets在stdio.h里面,你引入一下试试

用gets_s