c11可以使用gets, 但是从c14之后gets函数就不可以使用了,大家要注意编译器
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char str[1000];
cin.getline(str,1000);//(指针地址, 字符长度)
fgets(str, 1000, stdin);//(指针地址, 字符长度, stdin(必须加上))
int n = strlen(str);
cout << n << endl;
return 0;
}