hey im doing this craps game and im having a problem win i roll a 7 the message come on 7 still appears and i dont no how to get it off its fine for when i roll everything else i jus dont want it to pop up when you win...so if anyone could help??
# 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 << "\nPlace your bet and roll the dice (minimum $1): ";
cin >> bet;
while (bet < 1 || bet > money)
{
if (bet < 1)
cout << "\nDont be so cheap put some money on the table!";
if (bet > money)
cout << "\nYou don't have that much!";
cout << "\n\nPlace your bet and roll the dice (minimum $1): ";
cin >> bet;
}
else
{
do
{
cout << "You currently have $" << money << " on hand."<<endl; //copied the betting loop you had
cout << "\nPlace your bet and roll the dice (minimum $1): ";
cin >> bet;
while (bet < 1 || bet > money)
{
if (bet < 1)
cout << "\nC'mon, take a chance!";
if (bet > money)
cout << "\nYou don't have that much!";
cout << "\n\nPlace your bet (minimum $1): ";
cin >> bet;
}
cout << "You bet $" << bet << "."; //end betting loop
also if you want to be able to terminate the program,
a new variable: char betChar;
and
1 2 3 4 5
cout << "\nPlace your bet and roll the dice (minimum $1 - 'q' to quit): ";
cin >> betchar;
if (betChar == q || betChar == 'Q');
exit(1);
bet = atoi(betChar);
instead of
1 2
cout << "\nPlace your bet and roll the dice (minimum $1): ";
cin >> bet;
should do the trick (cant guarantee the last bit, not on my own comp)
EDITED: for being horrible with my ';''s and my code box's