get()在应用中开始被禁用(例如PAT),而scanf()只能输入一段字符串(不含空格),这就使得有一些特定的输入很难完成。
以下是替代的方法:
一、
string str;
getline(cin,str);
二、
char str[maxn];
fgets(str,maxn,stdin);
int num=0;
while(str[num]!='\n') num++;
str[num]='\0';
get()在应用中开始被禁用(例如PAT),而scanf()只能输入一段字符串(不含空格),这就使得有一些特定的输入很难完成。
以下是替代的方法:
一、
string str;
getline(cin,str);
二、
char str[maxn];
fgets(str,maxn,stdin);
int num=0;
while(str[num]!='\n') num++;
str[num]='\0';