My code looks like this,
string aString;
cin >> aString;
cout << "This is what cin gets:" << aString << endl;
getline(cin, aString);
cout << "This is what getline(cin, <string>) gets:" << aString << endl;
Each time I ran it, I give inputs like, "12", I get "12" and "".
I am wondering why getline would received without user input.
I can understand when I enter something like "12 24", cin will get "12", and getline should get the rest. (Also, if one could answer, the space in between is treated as an end for cin, so why is it passed on to getline?)
Just starting out on string on C++ so please don't make it too hard. Thanks you.