Lesson 3 of 24
Input with cin and getline
8 min 20 XP
cin >> x reads one value up to a space or new line. For a whole line with spaces use getline(cin, s). After cin >>, call cin.ignore() before getline to skip the leftover newline.
Example: edit me and press Run
Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.