Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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 Respostas
+ 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.