0

Why doesn't "cin >> ;" take input with spaces?

In multiple of my codes, I've made it so that the user has to put in a sentence that is stored in a string variable using cin. However, because sentences have spaces, it thinks it's been given multiple inputs, so it puts out the same number of outputs. Is there any way I can fix/work around this?

7th Feb 2020, 7:54 PM
THOMAS WALD
THOMAS WALD - avatar
2 odpowiedzi
+ 4
use: std::getline(std::cin, variable_name);
7th Feb 2020, 8:12 PM
Bahhaⵣ
Bahhaⵣ - avatar