0
how to read all the elements of input, Not only before space. Как считать все символы в строку включая пробелы
how to read all the elements of input, Not only before space. cin.getline dont works. Как считать все символы в строку включая пробелы. cin.getline не работает
3 odpowiedzi
+ 3
What kind of input are you trying to read? can you save the code and share the link in post Description for a clearer view of the problem?
+ 1
You could try using it this way, getline(cin, variable name) instead of cin.getline. It might help.
0
Thought of something that might also help, cin.getline takes a char string or C style type if I recall correctly. Like a char array, such as char phrase[12], 12 chars being hello world and null terminating char \0, which marks end of C style string
Cin.getline second parameter takes an int value of max chars to take in, such as the 12.
Both versions also have a third parameter , defaulted to newline (\n). This is what it reads to, can be other chars as well, like a '!' for instance.