#include "iostream"
#include "string"
using namespace std;
void main()
{
int a,b,c;
string name;
cout<<"a:";
cin>>a;
cout<<"b:";
cin>>b;
cin.ignore(1000,'\n');
cout<<"name:";
getline(cin,name);
cout<<"c:";
cin>>c;
cout<<"a:"<<a<<endl;
cout<<"b:"<<b<<endl;
cout<<"name:"<<name<<endl;
cout<<"c:"<<c<<endl;
}
运行发现每次输入name后不是直接让我输入c,而是处于阻塞等待我输入,此时输入回车才会跳出c:让我输入,我搞不懂为什么不是直接跳出c:让我输入???
哔哔one
饮歌长啸
相关分类