C++输入不定量的整数
int cnt = 0;
int t;
while (~scanf("%d" , &t))
{
cnt++;
if((getchar()) == '\n')
break;
}
cout << cnt << endl;
return 0;
}
C++输入不定量的字符串
int cnt = 0;
int t;
string str;
string strs;
while (getline(cin , str))
{
strs += str;
cnt++;
}
cout << strs << endl;
cout << cnt << endl;
return 0;