0

Problem of spaces in getting a string

I am facing this problem while taking string or char as an input from the user though the solution I use is 1. getline() and 2. ignore() both. But the next problem is that after using both of these. I am not able to take integer value as an input and every time I run my program it skips the cin part for int type. This is blowing my brain. Please help me. Example: string name getline(cin, name) cin.ignore() Int age Cin >> age Char occupation[100] Cin.getline(occupation, 100) Cin.ignore()

4th Sep 2023, 8:06 PM
RAJIV KUMAR KULIYA
3 odpowiedzi
+ 2
people are more likely to actually test your code if you link it. put it on sololearn playground and link it. check the spell. show the complete code, including ";" and main method etc.
4th Sep 2023, 10:31 PM
Lisa
Lisa - avatar
0
Ok I will post it later. But how can I do that. I mean taking my code from codeblocks IDE to sololearn
5th Sep 2023, 7:50 AM
RAJIV KUMAR KULIYA