### Game of craps

Hey guys, I'm trying to make a game of craps right now, but I'm having a few issues.

My first problem is I have no idea how to make it ask for another bet when I want to continue, it just adds/subtracts from the previous total.
Any help would be appreciated.

Second problem is right now when I run my program, it works if my numbers do not = 7 and the yes/no function still works.
But when it does = 7 and it asks to continue its just ends my program.

main code
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149`` ``````#include using namespace std; #include #include #include #include "header.h" void main () { int start (50); int bet (0); int point (0); int total (0); bool a; char ans; cout << "You have \$50. How much will you bet?" <> bet; if ((bet < 0 ) || (bet > 50)) do { cout << "Invalid bet. Enter another bet. " <> bet; } while ((bet < 0) || (bet > 50)); srand (time (0)); total = ThrowDie () + ThrowDie (); switch (total) { case 7: case 11: start = start + bet; cout << "You rolled " << total << ". You won!" << endl; cout << "You now have \$" << start << "." << endl; cout << "Play again? (Y/N)" << endl; cin >> ans; switch (ans) { case 'y': case 'Y': a = true; break; case 'n': case 'N': a = false; exit (0); cout << "Bye" << endl; break; default: cout << "Not valid. Enter another answer" <> ans; switch (ans) { case 'y': case 'Y': a = true; break; case 'n': case 'N': a = false; exit (0); cout << "Bye" << endl; break; default: cout << "Not valid. Enter another answer" <> ans; } else if (total == 7); { start = start - bet; cout <<"You lost," << endl; cout <<"You now have \$ " << start << "." << endl; cout <<"Play again? (Y/N)" << endl; cin >> ans; } switch (ans) { case 'y': case 'Y': a = true; break; case 'n': case 'N': a = false; exit (0); cout << "Bye" << endl; break; default: cout << "Not valid. Enter another answer" <

 ``12345678910111213141516171819`` ``````#include #include #include "header.h" void Initialize () { srand (time (0)); } int ThrowDie () { return (rand () % 6) + 1; } int ThrowDice () { return ThrowDie () + ThrowDie (); }``````

 ``12345678`` ``````#ifndef DICE_H #define DICE_H void Initialize (); int ThrowDie (); int ThrowDice (); #endif ``````

Topic archived. No new replies allowed.