I'm building a program for school that is supposed to be kind of like a slot machine. Except it is simulating three dice rolling, and different combinations (mostly matching numbers) yield a prize. The user should be allowed to opt out after any roll. I was hoping the do - while loop would work, but I am not able to test it because I get these lame errors, "159 C:\Users\Nathan\Desktop\main.cpp expected `;' before "else" and 159 C:\Users\Nathan\Desktop\main.cpp expected primary-expression before "else." This is the code I have so far.
//Author: Nate
//Title: The Easy Win Dice Game
/*Description: A Game that no one would ever play.*/
int main()
{
srand(time(0));
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
int die_1, die_2, die_3;
double starting_amount, current_amount;
char play_on;
cout<<"Welcome to the Easy Win Dice Game!\n";
cout<<"You can win either $20, $10, $2, or $0 depending on your roll\n";
cout<<"Each roll costs $2\n";
cout<<"Do you want to play?\n";
cout<<"Press 'Y then ENTER' if you are a champion\nor any other key then ENTER if you are a quitter\n";
cin>>play_on;
if ((play_on=='Y')||(play_on=='y'))
{
cout<<"You chose how much you want to start with:\n" << "$";
cin>>starting_amount;
cout<<"You Rolled:\n";
die_1=1+(rand()%6);
cout<<die_1;
cout<<", ";
die_2=1+(rand()%6);
cout<<die_2;
cout<<", and ";
die_3=1+(rand()%6);
cout<<die_3;
cout<<".";
cout<<"\nWould you like to play again?" <<endl;
cout<<"Yes (Y) or No (N)?" <<endl;
cin>>play_on;
}
else
{
cout<<"Thanks for playing!";
}
}while ((play_on=='Y')||(play_on=='y'));