提交时间:2023-08-22 17:19:14

运行 ID: 99426

#include<bits/stdc++.h> using namespace std; struct js{ int jinqian=0; int dengji=1; double gongji=1,fangyu=0; double xueliang=10; double ysxueliang=10; string xingming; }; struct gv{ double gongji,fangyu; double xueliang; }; int main(){ int yx; int gwsjxl=rand(); gv gw; js wj; cout<<"请输入您的姓名:"<<endl; cin>>wj.xingming; cout<<endl; cout<<"请选择模式()"<<endl; cout<<"1 普通模式"<<endl; cout<<"2 作弊模式"<<endl; cin>>yx; if(yx==1){ cout<<"你已启用普通模式!"; cout<<endl; while(1){ int o; cout<<wj.xingming<<",您想去做什么?"<<endl; cout<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"1 战斗"<<endl<<"2 查询个人信息"<<endl<<"0 退出游戏"<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cin>>o; if(o==0){ cout<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"感谢游玩!"<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; return 0; } else if(o==2){ cout<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"姓名:"<<wj.xingming<<endl<<"等级:"<<wj.dengji<<endl<<"金币:"<<wj.jinqian<<endl<<"攻击力:"<<wj.gongji<<endl<<"防御力:"<<wj.fangyu<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; } else if(o==1){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"请选择难度()"; cout<<endl; int nd; cout<<"--------------------------------------------------------"<<endl; cout<<"1 简单"<<endl<<"2 普通"<<endl<<"3 地狱"<<endl; cout<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cin>>nd; if(nd==1){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<endl<<endl; cout<<"菜坤迎面而来!" ; cout<<endl<<endl; gwsjxl=rand(); gwsjxl=rand(); gwsjxl=rand(); gw.xueliang=gwsjxl%=6; gw.gongji=0.25; gw.fangyu=0.5; bool pdd=1; while(gw.xueliang>0){ cout<<endl<<endl; printf( " ********\n" " ***********\n" " ****$****$****\n" " ****************\n" " *****\----/*****\n" " *****----*****\n" " ######### \n" " ####*******###### \n" " ...#***.****.***#....\n" " ....************.....\n" " ....**** *****....\n" " #### ####\n" " ###### ######\n" ); cout<<endl; cout<<" "<<"血量"<<gw.xueliang; cout<<endl<<endl<<endl; cout<<"怪物迎面而来!你要做什么?"; cout<<endl<<endl; cout<<" 剩余血量:"<<wj.xueliang<<endl; cout<<"1 攻击 2 查询怪物信息"<<endl; cout<<"3 饶恕 4 返回主页"<<endl; int ooo; cin>>ooo; if(ooo==1){ cout<<"你对怪物造成了"<<wj.gongji-gw.fangyu<<"点伤害!"; gw.xueliang-=wj.gongji-gw.fangyu; } else if (ooo==3){ cout<<"你饶恕了菜坤!"; gwsjxl=rand(); gwsjxl=rand(); gwsjxl=rand(); cout<<"你获得了"<<gwsjxl%10*2<<"个金币!"<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; wj.jinqian+=gwsjxl%10; pdd=0; break; } if(wj.fangyu<=gw.gongji){ cout<<endl<<endl; cout<<"怪物对你造成了" <<gw.gongji-wj.fangyu<<"点伤害!"; wj.xueliang-=gw.gongji-wj.fangyu; } else{ cout<<endl<<endl; cout<<"怪物对你造成了" <<0<<"点伤害!"; } } if(pdd){ gwsjxl=rand(); gwsjxl=rand(); gwsjxl=rand(); cout<<"怪物已阵亡,你获得了"<<gwsjxl%10<<"个金币!"<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; wj.jinqian+=gwsjxl%10; } wj.xueliang=wj.ysxueliang; } } else{ cout<<"6,你**在干什么?"<<endl; } } } else if(yx==2){ cout<<"你已启用作弊模式!"; cout<<endl; wj.jinqian=114514; wj.dengji=99; wj.gongji=1145,wj.fangyu=5418; wj.xueliang=114514.1145; while(1){ char o; cout<<wj.xingming<<",您想去做什么?"<<endl; cout<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"1 战斗"<<endl<<"2 查询个人信息"<<endl<<"0 退出游戏"<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cin>>o; if(o=='0'){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"感谢游玩!"<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; return 0; } else if(o=='2'){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"--------------------------------------------------------"<<endl; cout<<"姓名:"<<wj.xingming<<endl<<"等级:"<<wj.dengji<<endl<<"金币"<<wj.jinqian<<endl<<"攻击力:"<<wj.gongji<<endl<<"防御力:"<<wj.fangyu<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; } else if(o=='1'){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"请选择难度()"; cout<<endl; int nd; cout<<"--------------------------------------------------------"<<endl; cout<<"1 简单"<<endl<<"2 普通"<<endl<<"3 地狱"<<endl; cout<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cin>>nd; if(nd==1){ cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<"--------------------------------------------------------"<<endl<<endl; cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl; cout<<endl<<endl; cout<<"菜坤迎面而来!" ; cout<<endl<<endl; gwsjxl=rand(); gwsjxl=rand(); gwsjxl=rand(); gw.xueliang=gwsjxl%=6; gw.gongji=0.25; gw.fangyu=0.5; while(gw.xueliang>0){ cout<<endl<<endl; printf( " ********\n" " ***********\n" " ****$****$****\n" " ****************\n" " *****\----/*****\n" " *****----*****\n" " ######### \n" " ####*******###### \n" " ...#***.****.***#....\n" " ....************.....\n" " ....**** *****....\n" " #### ####\n" " ###### ######\n" ); cout<<endl; cout<<" "<<"血量"<<gw.xueliang; cout<<endl<<endl<<endl; cout<<"怪物迎面而来!你要做什么?"; cout<<endl<<endl; cout<<"1 攻击 2 查询怪物信息"<<endl; cout<<"3 饶恕 4 返回主页"<<endl; int ooo; cin>>ooo; if(ooo=1){ cout<<"你对怪物造成了"<<wj.gongji-gw.fangyu<<"!"; gw.xueliang-=wj.gongji-gw.fangyu; } } gwsjxl=rand(); gwsjxl=rand(); gwsjxl=rand(); cout<<"怪物已阵亡,你获得了"<<gwsjxl%10<<"个金币!"; } } else{ cout<<"6,你**在干什么?"<<endl; } } } return 0; }