In the game I am making, the player is given a riddle and asked to enter an answer. The answer is two words, and so a normal cin>> will not work. I tried to use a getline (see code below) but I couldn't get it to work. Any help would be appreciated.
----------------------------
string RiddleAnswer;
"Block of text"
getch(); // To pause
clrscr();
gotoxy(1,2); // Spacing
"Riddle"
cout<< "Riddle answer: ";
cin.ignore(100, '\n');
getline(cin, RiddleAnswer);
----------------------------
As you can see I tried to use an ignore to ignore the getch, but the first time the user was asked to input something it took the key pressed (for the getch) as the entry, which would result in an incorrect answer to the riddle. How do I make this work??
Any help appreciated!
Kyoto Oshiro