need help with code!

hi so im having some problem with my code so i think its because of the loops please check the code and tell me where i went 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#include <iostream>
#include <string.h>
#include<conio.h>
#include<stdlib.h>
#include<windows.h>

using namespace std;

string name;
string comname;
char gender;
int age;
char x;
int powers;
  int shops;
char a;
int strength = 20;
int speed = 10;
int aim = 30;
int dexterity = 35;

int money = 100;
int main()

{
   system("COLOR B");


    cout<<"       \n";
     cout<<"                 WELCOME TO LOST THE ZOMBIE ADVENTURE GAME!           \n "<<endl;
     cout<<"                              #################"<<endl;
     cout<<"                              # 1.How To Play #\n"
      "                              # 2.Rules       #\n"
      "                              # 3.Start       #\n"
      "                              # 4.Exit        #"<<endl;

     cout<<"                              #################"<<endl;

do{
      cin>>x;
      }
        while (x =='4');


if(x == '1'){
   cout<<"So to play this game all you got to do is type and the game will tell you how to play!"<<endl;
do{
      cin>>x;
      }  while (x =='4');
}


if(x == '2'){

  cout<<"Rules :1.make sure you press the right button that th game tells you or else you might lose!\n       2.to win Follow all game instructions!\n       3.Have fun!"<<endl;
do{
      cin>>x;
      }  while (x =='4');
}


if(x == '3'){
     cout<<"Hello There Whats Your Name:"<<endl;
   cin>>name;

}
     if(age >=  45){
        cout<<"Sorry but this game mighnt be for your age its too scary!"<<endl;
     }
     cout<<"How Old Are You:"<<endl;
cin>>age;

cout<<"Your name is "<< name <<"<"<< gender <<">"<<",You are "<<age<< "Years old." <<endl;
cout<<"You Went into to your bedroom ready to sleep then you hear this man screaming do you 1.sleep(s) 2.check whats going on(c)"<<endl;
cin>>a;

if(a== 's'){
    cout<<"you decided to sleep a Zombie jumped on you and ate you!"<<endl;
    cout << "********************************************************************************";
 

}
if(a == 'c'){
   cout<<"You have Decided to check out the Window you see a Zombie coming towards your house your scared what do you do? 1.get a knife(k) 2.jump out of the window(j)"<<endl;
cin>>a;
}
if(a == 'k'){

cout<<"You decided to get a Knife you went down tne kitchen and got a Knife  was  it   1.Big(1) or 2.Small(2)"<<endl;
cin>>a;
}
if (a == '1'){

    cout<<"you got the Big Knife!"<<endl;

}
if (a == '2'){
    cout<<"You Got The Small Knife!"<<endl;


}

cout<<"The zombie Started Knocking on the Door you got  your knife ready and the zombie knocked down the door do you 1.Run Away(r) 2.Attack Zombie (a)"<<endl;
cin>>a;
if(a == 'r'){

   cout<<"You have Decided to Run Away from The Zombie and you went through the back door"<<endl;
   cout<<"You Jumped Over The Fence But There was another zombie There !  1.Hit Head(h)   2.Stab Stomach(s)"<<endl;
}
if(a == 'a'){
    cout<<"You Have Decided to Attack The Zombie  1.Hit Head(h)   2.Stab Stomach(s)"<<endl;

cin>>a;

}
if(a == 'h'){
    cout<<"You hit the zombies head you killed it Well Done!"<<endl;

}
if(a == 's'){

    cout<<"You Stabbed The Zombie in the Stomach it fell down on the ground you killed it i think head would be better choice next time!"<<endl;

}
cout<<"Then you Hear your neighbour screaming do you go 1.help him<h> or 2.not<n>"<<endl;
cin>>a;
if(a == 'h'){
    cout<<"you decided to help your neighbour you jumped the fence and you see a zombie on your neighbbuor and your neighbour is struggling you swung at the zombie you missed!"<<endl;
 cout<<"PRESS ANY KEY TO FIGHT!"<<endl;
    cout<< string(10, '\n');
    cin>>a;
    cout<<"zombies health is 50 yours is a 100 "<<endl;
    cout<<"Press any key to Attack "<<endl;
    cin>>a ;
    cout<<name<<" sent a swing at the zombie and got him in the leg"<<endl;
    cout<<"Zombie jumped on you and and bit your hand"<<endl;
    cout<<"Zombies Health:20,"<<name<<"'s health is 50"<<endl;
    cout<<"your friend helped you he shot a gun at the zombie and killed it you got poison in your hand what do you do"<<endl;
    cout<<"1.amputate(a) 2.suck the poison out then stitch your hand!(s)"<<endl;
}
    cin>> a;
if(a == 'a'){
    cout<<"You decided to amputate your hand that wasnt a good choice but any way your friend cut off your hand from now on your gonig to have to survive wih one hand!"<<endl;

}

if(a == 's'){
    cout<<"Nice Choice your friend got a stringe and sucked out the poison and you got your hand stitched!"<<endl;



cout<<"Thank you for saving me Now we need to head to Town Or The Forest to hide these Zombies are just crazy!, 1.Town(t) 2.Forest(f)"<<endl;
cin>>a;
if(a == 't'){

    cout<<"You've Decided to go to Town theres alot of Zombies around Watch Out!"<<endl;
    system("cls");
       cout<<"      \n                                AREA:TOWN.              \n                 "<<endl;
cout<<"There is shops around which of these do you want to go into"<<endl;
cout<<" 1-Armory            MONEY: "<<money<<"   \n 2-Shop \n 3-Pharmacy\n 4-garage\n 5-Continue"<<endl;
cout<<"                                                                  MONEY:    "<<money<<endl;

}
cin>>shops;
  while(shops != 'b'){
switch(shops){
case 1:
    cout<<"      You are Now in the Armory which of these Items you want to Upgrade:"<<endl;
    cout<<"   1.Knife ...."<<endl;
    cin>>powers;
    cout<<"How Do you want to Upgrade It ?"<<endl;
    cout<<" 1. Its Strength 20p \n 2.The Speed 10p \n 3.The Aim 30p \n 4.Dexterity.20p"<<endl;
    cin>>powers;
}



}




while(money > 0){
    switch(powers){



    case 1:
       cout<<"You upgraded your knifes strength 20p has been taken off your money!"<<endl;
       money = money -20;
       cout<<" 10p Has been taken of your account!"<<endl;

        cout<<"                                          MONEY:"<<money<<endl;
        break;

         case 2:

        money = money - 10;



          cout<<"                                          MONEY:         "<<money<<endl;
         cout<<"You have upgraded The Speed Of Your item"<<endl;
             cout<<" 10p Has been taken of your account!"<<endl;
             money = money - 30;
          break;
         case 3:

                 cout<<"                                          MONEY:         "<<money<<endl;





        cout<<"You Have Increased the aim of your weapon."<<endl;
        cout<<" 30p Has been taken of your account!"<<endl;

          break;
         case 4:

              money = money- 35;


             cout<<"You Have increased The dexterity of your Weapon!"<<endl;
             cout<<" 35p Has been taken of your account!"<<endl;

      break;
      cout<<"                                          MONEY:         "<<money<<endl;
    }
if(money <= 0){
    cout<<"Sorry you dont Have Enough Money!"<<endl;

}
if(money < strength){
    cout<<"Sorry You Dont Have Enough Money!"<<endl;


}
if(money < speed){
    cout<<"Sorry You Dont Have Enough Money!"<<endl;


    if(money < aim){
    cout<<"Sorry You Dont Have Enough Money!"<<endl;
    }
    if(money < dexterity){
    cout<<"Sorry You Dont Have Enough Money!"<<endl;
    }








if(a == 'f'){

     cout<<"You've Decided to go to Forest theres alot of Zombies around Watch Out!"<<endl;
   cout<< string(5, '\n');
 cout<<"            \n                               AREA:FOREST.                             \n       "<<endl;


}






if(a == 'n'){
  cout<<"you decided to leave your neighbour die you jumped out over the fence your neighbour was lying dead and you saw the zombie you attacked him but you missed"<<endl;
   cout<<"PRESS ENTER TO FIGHT!"<<endl;
    cout<< string(10, '\n');
    cin>>a;
    cout<<"zombies health is 50 yours is a 100 "<<endl;
    cout<<"Press enter to attack "<<endl;
    cin>>a;
        cout<<name<<" sent a swing at the zombie and got him in the leg"<<endl;
    cout<<"Zombie jumped on you and and bit your hand"<<endl;
    cout<<"Zombies Health:20,"<<name<<"'s health is 50"<<endl;
    cout<<"no could help you you kicked the zombie in the stomach but it was no use the zombie killed you and you TURNED"<<endl;
   
system("pause");
    Sleep(5200);
    system("cls");
    cin>>a;
}



if(a =='j'){

    cout<<"You decided to jump out of the window as a Result you Died!"<<endl;
            cout<<"          GAME OVER!           "<<endl;



}


   do{
      cin>>x;
      }  while (x =='4');




if(x == '4'){
    system("PAUSE");
a = false;
do{
      cin>>x;
      }  while (x =='4');

}

}

}
}
}
Topic archived. No new replies allowed.