Reputation: 1
I want to let players press any key to continue with the game, but don't know how. Here is the code I have so far:
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "\t\tWelcome to my first game, A Hero's Journey!\n\n";
char response;
cout << "\t\t\tPress any key to continue!: \n\n";
cin >> response;
if (response ==
return 0;
}
I am currently working on the if statement, so disregard that unless that's where I decide whether or not a player has pressed something.
Upvotes: 0
Views: 112
Reputation: 41
There is no need for an if condition since cin will always wait for an input. If you require the user to input a particular key, then you need an if condition to check it.
Upvotes: 1