2021-10-01
作者:互联网
很水的一个游戏
#include
#include<windows.h>
#include<stdlib.h>
#include<time.h>
#include
using namespace std;
int main(){
//准备
int gold = 20;//金币
int Full = 25;//饱食度
int mr = 35;
string name;
int days = 1;
//开始
cout<<“你的名字?”;
cout<<endl;
cin>>name;
cout<<"------------------"<<endl;
cout<<"----乞丐模拟器----"<<endl;
cout<<"----1开始 关闭0—"<<endl;
cout<<"------------------"<<endl;
int choose;
cin>>choose;
while(true){
switch(choose){
case 1:{
if(Full0||Full<0||mr0| mr<0){//石了
system(“cls”);
cout<<"--------------------------------------------------"<<endl;
cout<<“你饿死了”<<endl;
cout<<“名字:”<<name<<"|"<<“天数:”<<days<<endl;
return 0;
}
cout<<"--------------------------------------------------"<<endl;
cout<<“名字:”<<name<<endl;
cout<<“天数: “;
for(int i=0;i<days;i++){
cout<<“■”;
}
cout<<days;
cout<<endl;
cout<<“饱食度:”;
for(int i=0;i<Full;i++){
cout<<“■”;
}cout<<Full<<endl;
cout<<“保水度: “;
for(int i=0;i<mr;i++){
cout<<“■”;
}
cout<<mr<<endl;
cout<<“金币数:”;
for(int i=0;i<gold;i++){
cout<<“■”;
}
cout<<gold<<endl;
cout<<”--------------------------------------------------”<<endl;
cout<<“选择你要干的事:”<<endl;
cout<<“输入1进行来退出”<<endl;
cout<<“输入2进行乞讨”<<endl;
cout<<“输入3啥也不干”<<endl;
cout<<“输入4进入↓↓”<<endl;
cout<<”--------商店----”<<endl;
int choose_2;
cin>>choose_2;
switch(choose_2){
case 1:{
break;
}
case 2:{
cout<<“金币++!”<<endl;
cout<<“原有金币:”<<gold<<“枚”<<endl;
srand((unsigned)time(NULL));
gold+=rand()%11;
cout<<“现有金币:”<<gold<<“枚”<<endl;
break;
}
case 3:{
system(“cls”);
break;
}
case 4:{
cout<<"--------------------------------------------------"<<endl;
cout<<“商店:”<<endl;
cout<<“现有金币:”<<gold<<endl;
cout<<“包子按1 6gold(回复4饱食度)”<<endl;
cout<<“面条按2 5gold(回复5饱食度)”<<endl;
cout<<“凉水按3 3gold(回复5保水度)”<<endl;
int choose_3;
cin>>choose_3;
switch(choose_3){
case 1:{//商店
if(gold>6||gold6){
cout<<"--------------------------------------------------"<<endl;
cout<<“成功!”;
cout<<“饱食度回复4!” ;
gold = gold-6;
Full+=4;
mr–;
break;
}
else{
cout<<"--------------------------------------------------"<<endl;
cout<<“金币不足!”<<endl;
break;
}
}
case 2:{
if(gold>6||gold6){
cout<<"--------------------------------------------------"<<endl;
cout<<“成功!”<<endl;
cout<<“饱食度回复5!” ;
gold = gold-6;
Full+=5;
mr–;
break;
}
else{
cout<<"--------------------------------------------------"<<endl;
cout<<“金币不足!”<<endl;
break;
}
break;
}
case 3:{
if(gold>3||gold==3){//水
cout<<"--------------------------------------------------"<<endl;
cout<<“饱水度回复5!” ;
cout<<“成功!”<<endl;
gold = gold-3;
mr+=5;
break;
}
else{
cout<<"--------------------------------------------------"<<endl;
cout<<“金币不足!”<<endl;
break;
}
break;
}
}
break;
}//商店
}//大
}
days++;
Full–;
mr–;
}
}
return 0;
}
标签:case,10,01,cout,gold,int,break,2021,choose 来源: https://blog.csdn.net/hanruize_2021/article/details/120578614