method 1:
string s;
cin>>s;
cout<<s<<endl;
method 2:
while(cin>>w) {
}
I can jump out of cin with enter in method 1, but it cannot be done in method 2. Instead, while(cin>>w && w!="end") can jump out with enter. What makes the difference?
Aucun commentaire:
Enregistrer un commentaire