How to add message at end of loop.
Problem:
Quote:
Write a menu program that lets the user select from a list of options, and if the input is not one of the options, reprint the list
Code:
#include <iostream>#include <string>
using namespace std;
int main( )
{
int choice = 0;
do
{
cout << "1: Play" << endl;
cout << "2: Scores" << endl;
cout << "3: Quit" << endl;
cout << endl;
cout << "Enter a number to continue: ";
cin >> choice;
}
while(!(choice == 1 || choice == 2 || choice == 3));
cout << "Great, You have selected an option";
cin.ignore();
cin.get();
return 0;
}
That works fine. But then I decided what if I wanted to display a message, before it displays the options again.
So I am thinking is my use of do whole loop the right choice?