Craps Game Loop

I cannot figure out (in my 'all of seven C++ classes' how to make this loop work right when the same digit can be used a second time in a different way.
I put my questions (and instructions on what I need to do after each // )
Thanks in advance for your help!

http://pastebin.com/raw/jZCZkLD6

or :

//trying to get game to play properly. Cannot figure out how to 7 out if first 7 is winning. Cannot figure out
// looping after point to continue.
//help?
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int firstDie, secDie, totalDie, pointDie, newtotalDie;
#define CRAPS_1 2
#define CRAPS_2 3
#define CRAPS_3 12

int main ()
{

//seed the random num generator
srand(time(0));

// generate two random numbers between 1 and 6
firstDie = rand() % 6 + 1;
secDie = rand() % 6 + 1;
totalDie = firstDie + secDie;

// display both random numbers, add together and display the sum
cout << "Player rolled " << firstDie << "+" << secDie << "=" << totalDie << endl << endl;

//if sum is 7 or 11, display 'Congratulations, you've won! Game over!'
if (totalDie == 7 || totalDie == 11)
{ cout << "Congratulatons! You've Won Craps!";
}
//if sum is 2, 3, or 12, display 'Game over, You hoser!'
else if (totalDie == CRAPS_1 || totalDie == CRAPS_2 || totalDie == CRAPS_3)
{ cout << "Game Over. You Lost, Hoser!" << endl;
}
//for any other sum, the sum is now the point and game continues until user rolls point again or a 7- save the sum, loop and continue game
// create variable and initialize it to a value of your choice to indicate game should continue
else if (totalDie == 1 || totalDie == 4 || totalDie == 5 || totalDie == 6 || totalDie == 8 || totalDie == 9 || totalDie == 10 )
{ pointDie = totalDie;
cout << "You rolled Point! Point is " << pointDie << endl;
cout << "Game continues until " << pointDie << " or a 7 is rolled." << endl << endl;
}
else
{
// in a loop that continues as long as the game continues-
firstDie = rand() % 6 + 1;
secDie = rand() % 6 + 1;
totalDie = firstDie + secDie;
}
// display both random numbers, add together and display the sum
cout << "Player rolled " << firstDie << "+" << secDie << "=" << totalDie << endl << endl;
if ( totalDie == pointDie )
{ cout << "Congratulations! You've Won Craps!";
}
else if (totalDie == 7)
{ cout << "You Seven'd Out. You Lost, Hoser!" << endl;
}
// if the sum is the same as the point, display congrats message. Also change the variable that controls the
// loop to indicate the game should no longer continue.
//game should use three symbolic constants. Options are:
// an integer for each of the values (2,3, 12) that represents craps on the first roll
// an integer that represents the value 7
// an integer that represents the value 11

// ask if player wants to play again, and execute properly.






return 0;

}
Topic archived. No new replies allowed.