Need help getting my craps program to work

October 12, 2010 at 14:39:03
Specs: Windows Vista
#include <iostream>
using namespace std;

int main ()
{
float point1; //The vaulue of the first roll, winning number after first role
float point2; //The value of the second roll
float n; //does the user want to play

//calculate

do
{
point1 = (1 + rand() % 6) + (1 + rand() % 6);
if (point1 == 7, 11)
cout << " You Won" << endl;
else if (point1 == 2, 3, 12)
cout << " You Lost" << endl;
do
{
point2 = (1 + rand() % 6) + (1 + rand() % 6);
if (point2 == point1)
cout << " You won" << endl;
else if (point2 == 7)
cout << " You Lost " << endl;
}
while (point1 != 2, 3, 7, 11, 12);
}
while (n=-1);

cout << " Do you want to play again? Yes enter 1, no enter 2" << n << endl;
cin >> n;
if (n = 1)
return 0;
if (n = 2)
cout << "Thank you for playing " << endl;

}

So this is the code that I have so far.

The problem i know that i have and i need fixed and don't know how to are as follows
1. I want the user to be able to activate the loop to start
2. I want the user to be able to replay the game as many times as desired (real kicker here because my teacher has not covered this and neither does our book yet)


See More: Need help getting my craps program to work

Report •


#1
October 14, 2010 at 08:54:18
1. I want the user to be able to activate the loop to start
Not sure what you're asking for.

2. I want the user to be able to replay the game as many times as desired (real kicker here because my teacher has not covered this and neither does our book yet)
Your class hasn't covered while or do-while loops yet?

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question