how to read all the elements of input, Not only before space. ŠšŠ°Šŗ счŠøтŠ°Ń‚ŃŒ Š²ŃŠµ сŠøŠ¼Š²Š¾Š»Ń‹ Š² стрŠ¾Šŗу Š²ŠŗŠ»ŃŽŃ‡Š°Ń ŠæрŠ¾Š±ŠµŠ»Ń‹ | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Š½Šµ рŠ°Š±Š¾Ń‚Š°ŠµŃ‚

14th Dec 2022, 2:01 PM
technocat
technocat - avatar
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?
14th Dec 2022, 3:41 PM
Ipang
+ 1
You could try using it this way, getline(cin, variable name) instead of cin.getline. It might help.
15th Dec 2022, 8:14 AM
Bloody Halos
Bloody Halos - avatar
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.
15th Dec 2022, 1:29 PM
Bloody Halos
Bloody Halos - avatar