Please help me!Xcode c++ dicegame with fake money bet!

Hey Dear programming friends! I'm Lily and i really need your help now and fast.. I´ve got this assignment for school, studying computergamedevelopment with music and sound. I'm at this moment in a little pickle where i need to make a dice game. player vs computer. First put in money all between 100-5000kr* (kr = swedish money^^) and then to bet on each round for 100, 300 or 500kr / round. 2 dice should be thrown by the player and then the computer and its best out of 3. each round is best of 3 so the third roll should only happen if its a tie between the 2 first ones. Okey so here below is my code so far but I'm getting thread breakpoint issues at the randomizer. PLEASE HELP ME i have to have it done in 2 days and I'm freaking out. Thanks for ur help. xoxo Lily92

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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
 #include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>



using namespace std;


int chargedmoney = 5001;
int saldo;                        //saldo means "blanace"
int satsning;                    //satsning means "bet"
bool loop_satsning=true;        
bool loop_redo1=true;            //redo means "ready"
bool loop_omstart=true;          //omstart = restart
bool loop_insattning=true;
string omstart;

int dice1, dice2, dice3, dice4;
int spelare=0, dator=0;           //spelare = player, dator=computer

int main()
{
    
    cout << "Hey and Welcome to SUPER-DICE-DELUXE!" <<endl<<endl;
    cout << "Please insert your name" <<endl<<endl;
    char name[20];
    cin >> name;
    
    cout << "Hi," << name << "! Please read the rules below!" <<endl<<endl<<endl;
    
    cout << "RULES:" <<endl;
    cout << "You need to bet either 100, 300 or 500 each time you play a new game." <<endl;
    cout << "To be able to bet you obviously need to put some money in, all from 100-5000" <<endl;
    cout << "After that you will choose the amount of money you want to bet and then you just have to roll the dice! The one to first roll highest two rounds out of three, will bring the money to his/her wallet! Have fun!" <<endl<<endl<<endl;
   
    string answere;
    cout << "Do you wish to play? yes or no!" <<endl<<endl;
    cin >> answere;
    if (answere == "yes"){
        cout << "Good choice!" <<endl <<endl <<endl;
        
        
        do {
            cout << "Choose the amount of money you would like to store in you Game-wallet" << endl<<endl;
            cin >> chargedmoney;
            saldo+=chargedmoney;
            
            if (chargedmoney==100-5000) {
                loop_insattning=false;
            }
            
       else if (chargedmoney> 5000){
            loop_insattning=true;
            saldo=0;
            cout << "You have entered a non-valid amount of money. Please try again" << endl;
            
        } else if (chargedmoney < 100) {
            cout << "You have entered a non-valid amount of money. Please try again" << endl << endl;
            loop_insattning=true;
            saldo=0;
            
        }
        
        do {
            cout << "Your current balance is " << saldo << " kr." <<endl;
            
            do {
                cout << "Choose the amount of money you would like to bet this round! (100kr, 300kr or 500kr)" << endl;
                cin >> satsning;
                
                if ((satsning == 100) || (satsning == 300) || (satsning == 500)) {
                    loop_satsning = true;
                    cout << "Your choice was to bet " << satsning << " kr." << endl;
                    
                } else {
                    loop_satsning = false;
                    cout << "You have entered a non-valid amount of money. Please try again" << endl;
                    
                    
                }
                
            } while (loop_satsning == false);
            
            
            string redo1;
            
            do { //OMGÅNG 1
                cout << "Are you ready for this round? yes or no!" << endl;
                
                cin >> redo1;
                
                if (redo1 == "yes") {
                    loop_redo1 = true;
                    cout << "Round has started!" << endl;
                    
                } else {
                    loop_redo1 = false;
                    
                }
            } while (loop_redo1 == false);
            
            
            
            while (true)
            {
                srand(time(0));
            
                dice1=rand() % 6 + 1;
                dice2=rand() % 6 + 1;
                cout <<"you got "<<dice1+dice2<<endl;
                
                dice3 = rand() % 6 + 1;
                dice4 = rand() % 6 + 1;
                cout <<"The computer got  "<<dice3+dice4<<endl;
                
                
                if (dice1+dice2 > dice3+dice4){
                    cout<<"Congratulations! You won this round! "<<endl;
                    spelare++;
                }
                else if (dice1+dice2 < dice3+dice4){
                    cout<<"Sorry, you lose! "<<endl;
                    dator++;
                }
                
                else{
                    cout<<"It's a tie! "<<endl;
                }
                
                if ((spelare==2)||(dator==2)){
                    break;
                }
            }
            if (spelare==2){
                cout<<"Well done! You won "<<(satsning*2)<<"kr"<<endl;
                saldo+= satsning*2;
            }
            else{
                cout<<"Unfortunatley, you lost "<<satsning<< " kr " <<endl <<endl;
                saldo-=satsning; ;
            }
            
            string omstart;
            cout<<"If you want to play again, please write yes!"<<endl;   //avslutning
            cin>>omstart;
            
            if  (omstart=="yes"){
                loop_omstart=true;
            }
            else{
                return 0;
            }
        }while (loop_omstart==true);
    }
    


    
        while (answere == "no");
        
        cout << "Well, I guess this is goodbye then.... Bye bye!" <<endl<<endl;
    
    
}
}
and right now I'm getting a thread1: breakpoint 2.1 error at;

srand(time(0));

dice1=rand() % 6 + 1;
dice2=rand() % 6 + 1;
cout <<"you got "<<dice1+dice2<<endl; //<-------right here i get it
Topic archived. No new replies allowed.