Don’t know how to add loop to my program…?

Its probably best for you to watch some youtube videos or read up on basics about loops. Anyways, here is a very simple way to understand this

#include <iostream>

int main(){

    char choice="Y";

    //enter this loop since 'choice' equals Y
    while(choice == 'Y'){

        //run the game

        //if they enter anything else other than Y, it will stop the loop
        std::cout << "Would you like to play again (Y for yes, N for no)? \n";
        std::cin >> choice;
    }

    return 0;
} 

Leave a Comment