有关getline()的问题
#include<iostream>
using namespace std;
int main()
{
char stringOne[256];
char stringTwo[256];
char stringThree[256];
cout << "Enter string one: ";
cin.getline(stringOne,256);
cout << "stringOne: " << stringOne << endl;
cout << "Enter string two: ";
cin >> stringTwo;
cout << "stringTwo: " << stringTwo << endl;
cout << "Enter sting three: ";
cin.getline(stringThree,256);
cout << "stringTree: " << stringTh bree << endl;
return 0;
}
程序输出为:
Enter string one: one two three
stringOne: one two three
Enter string two: four five six
stingTwo: four //此处为什么只输出了“four” ?
Enter string three: stringThree: five six //
所谓的 getline丢弃换行符是什么意思?