VC++ 2010 Crashes when I debug my program

I have an assignment for my beginner's programming class to create a craps program, I have finished the code and it will build successfully, but when I try to debug to test it VC++ acts like the console is open and nothing happens. I have tried using my second computer thinking the issue might be with my computer but had the same error. What could be keeping me from running my program?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <iostream>
using namespace std;
#include <cstdlib>
#include <ctime>

int rollDice( void );  
int main()
{
	char response;
   enum Status { CONTINUE, WON, LOST };
   int sum, myPoint;
   Status gameStatus;
   int bank=50, bet;

   cout << "You have $50 \n\n";

do
{
   cout << "Place your bet: ";
   cin >> bet;
   
   if (bet > bank)
   {
	   cout << "You can't bet more then you have in the bank. Bet again!\n";
	   cout << "Enter your new bet now: ";
	   cin >> bet;
   }
   
   srand ( (unsigned int)time(NULL) );
   sum = rollDice();        

switch ( sum ) 
   {
      case 7: 
      case 11:                  
         gameStatus = WON;

		 bank += bet;
		 cout << "You have $" << bank << endl;
         break;
      case 2: 
      case 3: 
      case 12:                 
         gameStatus = LOST;
	   

		 bank -= bet;
		 cout << "You have $" << bank << endl;
         break;
      default:                
         gameStatus = CONTINUE;
         myPoint = sum;
         cout << "Your point for this game is " << myPoint << " . Roll Again." << endl;
         break;                 
    }

 while ( gameStatus == CONTINUE )   
 {
      sum = rollDice();

      if ( sum == myPoint )      
	  {
        gameStatus = WON;
		bank += bet;
		cout << "You won by making point\n";
		cout << "You have $" << bank << endl;
	  }
      else
	  {
		  if ( sum == 7 )          
		  {
            cout << "You rolled a 7. You lost\n";
		  }
		  gameStatus = LOST;

		  bank -= bet;
		  cout << "You have $" << bank << endl;
	  }
 }

 if ( gameStatus == WON )
	 {
		 cout << "Player wins, would you like to play again? [y/n]" << "\n";
		 cin>>response;
 }
   else
       {
		 cout << "Player lose, would you like to play again? [y/n]" << "\n";
		 cin>>response;
 }
}
while(response=='y'); 

   return 0;
}


int rollDice( void )
{
   int die1, die2, workSum;

   die1 = 1 + rand() % 6;
   die2 = 1 + rand() % 6;
   workSum = die1 + die2;

   cout << "Player rolled " << die1 << " + " << die2
        << " = " << workSum << endl;

   return workSum;
}

Topic archived. No new replies allowed.