I am trying to get this portion of my C++ program to work so that the program reruns itself when 'y' is entered. When 'n' is entered, "Press any key to continue" needs to pop up.
What I have tried:
int main() {
char again;
if (again == 'y'){
// Asks user if they want to play again
cout << "Would you like to play again? (y/n):";
cin >> again;
} else if (again == 'n'){
cout << "Press any key to continue." << endl;
cin.ignore(1);
Output should look like this when 'n' is entered: Would you like to play again? n Press any key to continue . . .
output for 'y' should restart entire program