Craps game C++ with menu and chips! NEED HELP!

My craps game works but it doesn't compile anymore and it wont even execute anymore without errors. What am i doing wrong?

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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 #include <cstdlib>
#include <iostream>

using namespace std;

/*
 * 
 */



int main(int argc, char** argv) {
  
    int choice;
    int chips=100;
    
    do
    {
        cout<< "************************************" << endl;
        cout<< "Chips:"<< chips<< endl;
        cout<< "1: Start Craps Game. "<< endl;
        cout<< "2: Start"<< endl;
        cout<< "3: Exit Casino with remaining chips!" << endl;
        cout<< "************************************"<< endl;
        cout<< "Enter your choice followed by enter: ";
        cin>> choice;
    
        
        switch (choice)
        {
            case 1: //Craps.
                
                
     int main1() ;
     int games, dice1, dice2, dice3, dice4, roll, roll2, bet, x , y ;
    
     int currgames=0;
     char start;
    
     cout << endl <<"Chips: "<< chips;
     cout<< endl << "Welcome to the Craps game!"<< endl;
     cout<< "How many games would you like to play? ";
     cin>> games;
        
     while(currgames<games)
     {
        cout << endl << "Chips Remaining: " << chips << endl;
        cout << "Place your bet!" <<endl;
        cout << "Maximum bet is: " <<chips<<endl;
        cin >> bet;
        if (bet>chips)
        {
            cout<< "Insufficient chips to bet!";
        }
        
        else
        {
        cout<< endl<<"Press any character followed by enter to roll the dice! ";
        cin>> start;
        
        srand(time(0));
        dice1= rand() % 6 + 1;
        dice2= rand() % 6 + 1;
        roll= dice1 + dice2;
        cout << roll<< endl;
        
        
        if (roll== 7 || roll== 11)
        {
          cout<< "You win!" << endl;
          chips+= bet ;
        }
        else if (roll == 2 || roll == 3 || roll == 12) 
        {
            cout << "You lose!"<< endl;
            chips-= bet;
        }
        else
        {
            roll = true;
            while(roll == true)
            {
       
            
        cout <<endl<< "You are now in Round 2 of Craps! " << endl;
        cout << "Press any character followed by enter to roll the dice!";
        cin>> start;
        
        srand(time(0));
        dice3= rand() % 6 + 1;
        dice4= rand() % 6 + 1;
        roll2 = dice3 + dice4;
        
        cout << roll2 << endl;  
        

        if (roll == roll2)
        {
          cout<< "You win!" << endl;  
          chips+=bet ;
          roll= false;
        }
        else if (roll2==7)
        {
         cout << "You lose!"<< endl;
         chips-= bet;
         roll= false;
         
        }
            
        else
        {
            
        
        roll= true;
        }
            }
       currgames++;
        }
     }break; //end of craps 
        }//end of switch   
    
    }while (choice !=0 || chips >=0);
    
   
    return 0;}
Your ending curly brace on line 121 that says it is the end of switch is actually ending the open curly brace on line 46 that goes with the while statement.

Double-check your curly braces. You need an extra one in your program I think.

As a side-note, indent your code so that everything inside a brace gets indented over... that will help you immediately see what code goes within which curly brace.
Topic archived. No new replies allowed.