Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

# include <iostream> # include <cmath> # include <iomanip> # include <cstdlib> u

ID: 3620403 • Letter: #

Question

# include <iostream>
# include <cmath>
# include <iomanip>
# include <cstdlib>
using namespace std;
int main()
{
int die1;
int die2;
int dice;
int bet;
int point;
int money = 100;
char roll;

do
{
cout << "You currently have $" << money << " on hand.";

cout << " Place your bet and roll the dice (minimum $1): ";
cin >> bet;

while (bet < 1 || bet > money)
{
char betChar;
if (bet < 1)
cout << " Dont be so cheap put some money on the table!";
if (bet > money)
cout << " You don't have that much!";
cout << " Place your bet and roll the dice (minimum $1 - 'q' to quit): ";
cin >> betChar;
if (betChar == 'q' || betChar == 'Q')
exit(1);
bet=betChar;


cout << "You bet $" << bet << ".";


cin.get(roll);

die1 = rand() % 6 + 1;
die2 = rand() % 6 + 1;
dice = die1 + die2;

cout << " You rolled a " << die1 << " and a " << die2
<< " for a total of " << dice << "."<<endl;

if (dice == 7 )
{
cout << "Youve won"<<endl;
money += bet;
}


else if (dice == 11)
{
cout << "Youve lost"<<endl;
money -= bet;
}

else
{
do
{
cout << "You currently have $" << money << " on hand."<<endl;
cout << " Place your bet and roll the dice (minimum $1): ";
cin >> bet;
while (bet < 1 || bet > money)
{
if (bet < 1)
cout << " C'mon, take a chance!";
if (bet > money)
cout << " You don't have that much!";
cout << " Place your bet (minimum $1): ";
cin >> bet;
}
cout << "You bet $" << bet << ".";

cin.get(roll);

die1 = rand() % 6 + 1;
die2 = rand() % 6 + 1;
dice = die1 + die2;

cout << " You rolled a " << die1
<< " and a " << die2
<< " for a total of " << dice << ".";

if (dice == 7)
{
cout << " YOU WON!!!! lets raise the Stakes"<<endl;
money += bet;
}

if (dice == 11)
{
cout << " YOU LOSE its ok you can WIN it back"<<endl;
money -= bet;
}

else
{
cout << " Cooooommmee on 7. "<<endl;

}

} while (dice != point || dice != 7);
}

while (money > 0);

cout << "/nLooks like you ran out of money. "
<< "Thanks for playing!" << endl;
system ("pause");








Explanation / Answer

Looks like your issues are with closing parentheses and the condition of your first while loop was set so that the game only started if the user bet less than $1 or more money than what they had on file. I corrected those issues and it looks like the craps game is working properly. See how it works for you now. # include # include # include # include using namespace std; int main() { int die1; int die2; int dice; int bet; int point; int money = 100; char roll; do { cout