C / C + + programming diary: strategy play strange text games (repair optimization version with source code)

Time:2021-2-12

This game is very simple. It is a game composed of a for loop, several while and multiple if statements

 

#includeusingnamespacestd;intmain(){intshengming=30,gongji=10,jinbi=10,smsx=30,duobi1=3;inta=0,b=0,c=0,d=0;cout<

for(inti=0;i<1;i–){cout<>a;if(a==1){while(1){cout<=10″<=40″<=15″<>b;if(b==1&&jinbi>=10){

while(1){cout<>c;if(c==1&&jinbi>=10){gongji+=5;jinbi-=10;cout<=50){gongji+=25;jinbi-=50;cout<

 

<=200){gongji+=100;jinbi-=200;cout<=1000){gongji+=500;jinbi-=1000;cout<

{break;}elseif(c>3){cout<=10){shengming=smsx;jinbi-=10;cout<=40){while(1){cout<>c;if(c==1){smsx+=10;shengming+=10;jinbi-=40;cout<

<=100){smsx+=25;shengming+=25;jinbi-=100;cout<=400){smsx+=100;shengming+=100;jinbi-=400;cout<=2000){smsx+=500;shengming+=500;jinbi-=2000;cout<

<=15){while(1){cout<>c;if(c==1){duobi1+=1;jinbi-=15;cout<

 


<=100){duobi1+=10;jinbi-=150;cout<=400){duobi1+=20;jinbi-=300;cout<

<=2000){duobi1+=100;jinbi-=1500;cout<

Hit 100 to get 100 “gold coin”<>b;if(b==1){intsm=20,gj=10;intduobi=duobi1;cout<0){cout<>c;if(c==1){shengming-=gj;sm-=gongji;cout<0){cout<

<

<0){cout<>c;if(c==1){shengming-=gj;sm-=gongji;cout<0){cout<

 

<0){cout<>c;if(c==1){shengming-=gj;sm-=gongji;cout<

<0){cout<

<0){cout<

Enter: C; if (C = = 1) {Shengming – = GJ; SM – = Gongji; cout<0){cout<

<

<

 

1. Revised unreasonable words and typos

2. Optimized combat, no more dead loop or infinite evasion

3. Add the demon king, you can pass the Customs after victory

4. Fixed the number of gold coins won by victory

5. More user-friendly purchasing interface

6. You won’t quit the game immediately after you die. You will quit after pressing the key

7. Revised the plot (just four words ㄟ (▔, ▔) ㄏ)

8. Add exit function

 

Recommended Today

Rust and python: why rust can replace Python

In this guide, we compare the rust and python programming languages. We will discuss the applicable use cases in each case, review the advantages and disadvantages of using rust and python, and explain why rust might replace python. I will introduce the following: What is rust? What is Python? When to use rust When to […]