CS student just starting out with C++ and I'm having difficulty understanding how cin and getline() read in data.
string str_1 = "";
cin >> str_1; // User enters "John(Enter)"
Its my understanding that cin >> will look in the input buffer for data, if none is found it will prompt the user. It will then read in "John" leaving behind a line return \n in the buffer.
If getline() is called after that it will see \n and return nothing right?
If cin is called next it will work as expected, why doesn't cin see the line return in the buffer and terminate?