Help with my Craps game

I am having problems with my code that I am programming for craps game. For some reason the person always wins so I think that there is a problem with my loops. Can one of you geniuses please help?

Thank you in advance

include <cstdlib>
#include <cstdio>
#include <cstdarg>
#include <cmath>
#include <string>
#include <iostream>
#include <ctime>

using namespace std;

int bet, choice = 1,side,money = 1000,point;

int random_value(int x)
{
return (rand() % x);
}
int main()
{
while (choice == 1) // keeps the game going
{
cout<<"BASIC CRAPS!!! \n"; //intro screen
cout<<"WELCOME TO THE TABLE!!! \n";
cout<<"NOTICE: We do not do come or sucker bets. \n";
cout<<"The shooter is ready. Are you? (1)Yes (2)No \n";
cin>>choice;
if (choice == 2) // exits if no is selected
{
break;
}
if (money <= 0)
{
cout<<"Sorry!!! Out of money. Better luck next time. \n";
break;
}
cout<<"Pass(1) or No Pass(2)? \n"; // pick side
cin>>side;
cout<<"Place your bet: \n"; // makes the bet
cin>>bet;
cout<<"Here comes the roll!!! \n";
srand(time(NULL));
int dice1 = random_value (5)+1;
int dice2 = random_value (5)+1;
if (dice1 == 1) // generates two dice and displays
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"|_________| \n";
}
else if (dice1 == 2)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 3)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 4)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 5)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
if (dice2 == 1)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"|_________| \n";
}
else if (dice2 == 2)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 3)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 4)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 5)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
int sum = dice1 + dice2; //sums the dice
if (side == 1) // see if pass line won
{
if (sum == 7 || sum == 11)
{
cout<<"YOU WIN!!! \n";
money = money + (2*bet);
cout<<"You are now at: $"<<money<<" \n";
}
else if (sum == 2 || sum == 3 || sum == 12)
{
cout<<"YOU LOSE!!! \n";
money = money - bet;
break;
}
else
{
cout<<"Here's the next roll! \n";
}
}
else if (side == 2) //see if no pass line won
{
if (sum == 2 || sum == 3 || sum == 12)
{
cout<<"YOU WIN!!! \n";
money = money + (2*bet);
cout<<"You are now at: $"<<money<<" \n";
}
else if (sum == 7 || sum == 11)
{
cout<<"YOU LOSE!!! \n";
money = money - bet;
break;
}
else
{
cout<<"Here's the next roll! \n";
}
}
else if (sum == 4|| sum == 5|| sum == 6|| sum == 8|| sum == 9|| sum == 10) //after come-out roll
{
point = sum; //sets point
while (sum != point || sum != 7)
{
srand(time(NULL)); //gets new dice on screen
int dice1 = random_value (5)+1;
int dice2 = random_value (5)+1;
Here is my second part...

if (dice1 == 1)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"|_________| \n";
}
else if (dice1 == 2)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 3)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 4)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else if (dice1 == 5)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
if (dice2 == 1)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"|_________| \n";
}
else if (dice2 == 2)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 3)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"| O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 4)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else if (dice2 == 5)
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
else
{
cout<<"___________ \n";
cout<<"| | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"| O O | \n";
cout<<"|_________| \n";
}
int sum = dice1 + dice2;
}
}
if (sum == 7 && side == 1) //sees if pass won
{
cout<<"YOU WIN!!! \n";
money = money + (2*bet);
cout<<"You are now at: $"<<money<<" \n";
}
else if (sum == point && side == 2) //sees if no pass won
{
cout<<"YOU WIN!!! \n";
money = money + (2*bet);
cout<<"You are now at: $"<<money<<" \n";
}
}
return (0);
}
Topic archived. No new replies allowed.