Hi,
I have just been rounding off learning the basics of working with C++ at the console level by coding a very simple game. Part of this entails opting to play the game again.
Basically, i if the user enters "y" then i need to call the start function again otherwise the program can terminate normally.
I also have (before the above):Code:int main() {
start();
cout << "Play Again? (y/n)... ";
cin.ignore();
cin.getline(again,2);
cout << "|" << again << "|" << endl; //debug: again is empty?
if (strcmp(again,"y") == 0) start();
system("pause");
return 0;
}
Before strcmp i also tried: if (again == "y") {Code:char again[2];
The problem seems to be before that though, with getline as the again variable is empty.
How should i be doing this?
Thank you