First off, you need to start by looping on the first user choice: if they enter an "Invalid input" then it complains, but lets them play anyway - that's bad. Add a "valid entry" variable, and loop until you get one.
Second, you need a second loop for the user input of the actual game. This time, you loop for the number of rounds the user selected: 3, 5, or 7.
The way I'd do it, is to abstract the code into functions: start with a GetRounds function:
int GetRounds()
{
bool isValid = false;
int numberRounds = 0;
while (!isValid)
{
cout << "Do you want to play 3, 5 or 7 rounds?" << endl;
cin >> numberRounds;
switch(numberRounds)
{
case 3:
case 5:
case 7:
isValid = true;
break;
default:
cout << "Invalid input. Enter 3, 5 or 7." << endl;
break;
}
}
cout<<"You picked best of " << numberRounds << " rounds."<<endl;
return numberRounds;
}
Then call that from your Main function.
Add a second "PlayRound" function - you can write that one yourself - and use a
for
loop to call it the number of times that the user selected.
Make the PlayRounds function return 1 for player win, -1 for computer win, and 0 for a draw, then add up each result. At the end, a positive total is a player win for the session, negative is a computer session victory.
Start by trying that, and see how far you get.