求教vc编译的一个问题
这是我从《现代c++程序设计》中的一个编程例子#include<iostream>
#include<string>
using namespace std;
int main()
{
string name;
string school;
string favLang="c++,of course";
cout<<"\n c++ programming student demographics";
cout<<"\n Please enter your name:";
getline(cin,name);
cout<<"Please enter your school:";
getline(cin,school);
cout<<"\n Programming Student Data:"
<<"\n Name:"<<name
<<"\n School:"<<school
<<"\n Favorite language:"<<favLang<<endl;
return 0;
}
我在我的vc里运行却和书上的不一样 我的是在输入name 的时候就直接输入school了 在往下运行就是school那一样是空的了这是怎么回子事呀?