来吧今天来解一下津津的储蓄计划这道题。。。
我看了这题先想到了:津津确实太幸福了,我还没有零花。。。
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?我们可爱的if
主要考察:循环使用,数组使用;
难度:?????;
废话不多说直接上代码(我知道你们不想看别的。。。)
想看的看注释。。。
#include <iostream>
using namespace std;
int main()
{
int a[15];//每月预计花销,多来几个以防数组越界
int money=0;//津津手上的钱钱
int mama=0;//mama为津津存在妈妈那里的小钱钱
int m;//第几个月津津穷了
bool flag=true;//是否穷了
int e;//最后从麻麻那里来的钱钱
for(int i=1;i<=12;i++)
{
cin>>a[i];
}
for(int j=1;j<=12;j++)//循环十二次代表12月
{
money+=300-a[j];//每月增加的钱钱和花销后的钱钱
if(money<0)
{
flag=false;
m=j;
break;
}
else
{
while(money>=100)//超过100交给麻麻
{
money-=100;
mama+=100;
}
}
}
e=mama*0.2+mama;
if(flag==false)
{
cout<<-m;
}
else
{
cout<<e+money;
}
return 0;
}
?附赠一款游戏,玩去吧孩子(别瞎输,我不会懒得写while)
//作者微信号18331157738
#include <iostream>
#include <string>
#include <windows.h>
#include <ctime>
using namespace std;
int main()
{
srand((int)time(0));
int a,d;
string str;
cout<<"温馨提示:请不要输入除提示以外的数据\n如导致程序不可以,请自行负责!!!\n主要还是作者懒得写while()循环。。。\n";
Sleep(3000);
cout<<"\n以下为游戏内容:";
Sleep(100) ;
cout<<"\n\n\n\n宁静的下午";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"电话响了:";
Sleep(1000);
cout<<"“10086来电” ";
Sleep(100);
cout<<"\n请选择:1.接听 2.挂断 3.接听后痛骂\n";
cin>>a;
if(a==1)
{
cout<<"你拿起了电话";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"您好,尊敬的用户,您的电话费已欠费,共计10098.00元";
cout<<"\n请您缴费。 \n激活任务!";
Sleep(1000);
cout<<" 与老李斗智斗勇" ;
cout<<"\n请选择: 1.缴费 2.挂断 \n";
cin>>d;
if(a==1)
{
cout<<"您交给了老李10098元\n";
cout<<"转帐中.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<"\n转账成功!";
cout<<"\n现在日子看似平静\n";
cout<<"几天后.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<"你被警察以老赖名义逮捕了";
cout<<"你输了";
Sleep(10000);
return 0;
}
}
else
if(a==2||d==2)
{
for(int i=1;i<=5;i++)
{
cout<<"您挂断了电话.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<"\n电话响了:“10086来电”\n";
cout<<"请选择: 1.接听 2.挂断\n";
cin>>a;
if(a==1)
{
break;
}
else
if(a!=2)
{
cout<<"/n(作者比较懒)";
Sleep(1000);
cout<<"\a由于您的操作错误,程序出现问题,请重启程序\n";
Sleep(10000);
return 0;
}
}
if(a==1)
{
cout<<"你拿起了电话";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"您好,尊敬的用户,您的电话费已欠费,共计10098090.00元";
cout<<"\n请您缴费。 \n激活任务!";
Sleep(1000);
cout<<" 与老李斗智斗勇" ;
cout<<"\n请选择: 1.缴费 2.挂断 \n";//未完成
cin>>a;
}
else
if(a==2)
{
cout<<"您挂断了电话";
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<"\n真10086来电,您无权利拒接";
cout<<"\n10086:用户您好,刚刚收到的电话已耗费您1009990987.00元,已从您的账户中扣除";
cout<<"\n 现在您的余额为15元\n";
cout<<"电话挂断了";
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<"\n\n主要任务转变!!!";
cout<<"\n主要任务:生存下去;次要任务: 与老李斗智斗勇";
cout<<"\n\n\n游戏转移中.";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<"\n转移完成";
int paomian=5;
int shui=10;
int yue=15;
int jiankang=12;
int day=15;
int zhishi=1;
int biji=0;
int regou=0;
for(int i=1;i<=10000;i++)
{
int b;
int c=0;//有没有遇见乞丐
jiankang--;
if(jiankang<=0)
{
cout<<"您死了..." ;
cout<<"\n游戏结束";
Sleep(1000);
return 0;
}
cout<<"\n\n您的库存:泡面 水资源 余额 作者的笔记 热狗 \n";
cout<<" "<<paomian<<" "<<shui<<" "<<yue<<" "<<biji<<" "<<regou<<endl;
cout<<"您的健康程度:"<<jiankang<<endl;//<<"\n距离交水费电费还有"<< day<<"(如果失去水电费您的健康值会不停下降)\n";
cout<<"\n您的知识程度:"<<zhishi<<"\n\n\n请选择: 1.吃泡面 2.出门走走 3.摄取知识 4.自杀 5.吃掉热狗\n";
cin>>b;
if(b==1)
{
if(paomian>0)
{
cout<<"\n您服用了泡面.";
jiankang+=2;
cout<<"恢复了两点健康值\n";
paomian-=2;
}
}
else
if(b==2)
{
cout<<"您出门了.";
Sleep(500);
cout<<".";
Sleep(500);
cout<<".";
Sleep(500);
cout<<"\n您要去哪?\n请选择:1.超市 2.街道 3.广场";//未完成
cin>>a;
if(a==1)//未完成
{
cout<<"你可购买:1.泡面 3元\n";
cout<<" 2.热狗 5元\n";
cout<<" 3.作者的笔记 10000000元\n";
cout<<" 0.啥也不买\n";
cin>>b;
if(b==1)
{
if(yue>=3)
{
cout<<"购买成功\n";
paomian++;
}
else
{
cout<<"店员:穷鬼!\n";
}
}
else
if(b==2)
{
if(yue>=5)
{
cout<<"购买成功\n";
regou++;
}
else
{
cout<<"店员:穷鬼!\n";
}
}
else
if(b==3)
{
if(yue>=10000000)
{
cout<<"购买成功\n";
biji++;
}
else
{
cout<<"店员:穷鬼!\n";
}
}
else
if(b==0)
{
cout<<"店员:穷鬼!\n";
}
}
else
if(a==2)//未完成
{
if(c==0)
{
cout<<"你看见了一个乞丐\n请选择:1.给他十块 2.不理他\n";
cin>>b;
if(b==1)
{
cout<<"\n乞丐收下了十块钱,他掏出了一本书\n";
cout<<"\a";
yue--;
Sleep(100);
cout<<"\a";
Sleep(100);
cout<<"\a";
cout<<"作者的笔记!!!\n";
biji++;
}
else
if(b==2)
{
cout<<"你路过了他\n";
}
}
else
{
cout<<"路过了烘焙店,你摸着自己的肚子,健康的减2\n";
jiankang-=2;
}
}
else
if(a==3)//未完成
{
if(i>=4)
{
cout<<"您见到了老李.";
cout<<"\n请选择:1.报警 2.暴揍老李 3.路过\n";
cin>>b;
if(b==1)
{
cout<<"您掏出了电话拨了110.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"“您的电话已欠费。。。”\n";
cout<<"您只可以路过。。。\n心中那个气啊,健康值减一\n";
jiankang--;
Sleep(1000);
}
if(b==2)
{
cout<<"向老李走去.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"啪!啪!啪!\n";
cout<<"啊啊啊!\n";
cout<<"请选择:1.继续打2.放了他\n";
cin>>d;
if(d==1)
{
cout<<"\n老李被你打死了";
Sleep(500);
cout<<"\n警察逮捕了你\n";
cout<<"你输了";
Sleep(10000);
return 0;
}
else
{
cout<<"\n你停手了。。。\n心中那个爽啊,健康值加一\n";
jiankang++;
}
}
if(b==3)
{
cout<<"您只可以路过。。。\n心中那个气啊,健康值减一\n";
jiankang--;
Sleep(1000);
}
}
else
{
cout<<"你收获了10元\n";
yue+=10;
}
}
}
else
if(b==3)
{
cout<<"您正在学习中,请勿打断";
cout<<"\n";
if(zhishi<=0)
{
cout<<"你:阿巴阿巴阿巴\n";
cout<<"您的智商过低无法补救" ;
cout<<"\n你输了";
Sleep(10000);
return 0;
}
else
if(zhishi==1)
{
cout<<"请回答:44+44=";
cin>>a;
if(a==88)
{
cout<<"\n作者:“欸”";
cout<<"\n恭喜您答对了,知识点加一\n";
zhishi++;
}
else
{
cout<<"\n您答错了";
cout<<"\n知识点减一\n";
zhishi--;
}
}
else
if(zhishi==2)//需修改
{
cout<<"请回答:c++中printf与scanf的文件头(如cin,cout的文件头为iostream)是 ";
cout<<"请选择:1.cstdio 2.iomanip 3.string";
cin>>a;
if(a==1)
{
cout<<"\n作者:“嗯嗯”";
cout<<"\n恭喜您答对了,知识点加二\n";
zhishi+=2;
}
else
{
cout<<"\n您答错了";
cout<<"\n知识点减二\n";
zhishi-=2;
}
}
else
if(zhishi==4)
{
cout<<"请回答:你觉得自己傻不傻\n请选择:1.傻2.不傻";
cin>>a;
if(a==1)
{
cout<<"\n作者:“最喜欢诚实的孩子了”";
cout<<"\n恭喜您答对了,知识点加四\n";
zhishi+=4;
}
else
{
cout<<"\n作者:“。。。最讨厌自作聪明的人了扣四分”";
cout<<"\n知识点减四\n ";
zhishi-=4;
}
}
else
if(zhishi>=6&&biji>=1)
{
cout<<"你学习了作者的笔记,虽说啥也没看懂但是知识点+100";
Sleep(3000);
biji--;
zhishi+=100;
}
else
{
cout<<"您没有可供学习的书籍了";
}
}
else
if(b==4)//未完成
{
if(i>=2&&zhishi>=100)//有问题
{
int e,f;
cout<<"你站到了楼顶,您跳了下去";
cout<<"啊" ;
Sleep(500);
cout<<"啊";
Sleep(500);
cout<<"啊";
Sleep(500);
cout<<"\n一位老者救了你并给了你100000000元还给您交了水电费,他要求你打败老李\n";
yue+100000000;
cout<<"请选择:1.同意\n";
cin>>d;
cout<<"任务完成!\n";
Sleep(1000);
cout<<"\n他带你去了商场(注意:字母是我故意打的)\n";
cout<<"请选择:1.煞魔圣剑:99999999元\n";
cout<<" 2.dijia奥特曼变身器:99999999元\n";
cout<<" 3.马保国视频:99999999元\n";
cout<<" 4.c++编程教材:109元\n";
cout<<" \n";
cout<<" \n";
cin>>d;
if(d==1)
{
cout<<"你购买了煞魔圣剑!\n" ;
yue-=99999999;
cout<<"你找到了老李\n";
cout<<"你:来吧!老李!!!\n";
cout<<"老李:你来吧,我让你一招\n";
cout<<"请选择:1.鬼*斩 2.欙*刺 3.会心连招\n";
cin>>e;
if(e==1)
{
cout<<"\n你使用了鬼*斩\n";
Sleep(1000);
cout<<"老李血量-0.000001\n";
cout<<"老李:就这?\n";
Sleep(1000);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
else
if(e==2)
{
cout<<"\n你使用了欙*刺\n";
Sleep(1000);
cout<<"老李血量-0.000001\n";
cout<<"老李:就这?\n";
Sleep(1000);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
else
if(e==3)
{
cout<<"\n你使用了会心连招\n";
Sleep(1000);
cout<<"踢! ";
cout<<"劈! ";
cout<<"斩! ";
cout<<"老李血量-0.000003\n";
cout<<"老李:就这?\n";
Sleep(1000);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
}
else
if(d==2)
{
cout<<"你购买了dijia变身器";
yue-=99999999;
cout<<"\n你找到了老李\n请选择:";
cout<<"1.直接开打 2.水一下游戏进度\n";
cin>>e;
if(e==1)
{
cout<<"开始变身!!!\n";
cout<<"喝!" ;
Sleep(500);
cout<<"哈!" ;
Sleep(500);
cout<<"嘿!\n" ;
Sleep(500);
cout<<"低价奥特曼(我没打错)!\n" ;
Sleep(1000);
cout<<"变身!\n" ;
Sleep(500);
cout<<"你变成了低价奥特曼\n";
cout<<"请选择技能:1.不痛不痒拳! 2.全力一击 3.低价guangbo\n";
cin>> f;
if(f==1)
{
cout<<"你使用了不痛不痒拳\n你打出了暴击";
Sleep(500);
cout<<"\n对老李造成0点伤害\n";
cout<<"老李:就这?\n";
Sleep(1000);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
else
if(f==2)
{
cout<<"你使用了不全力一击\n你打出了暴击";
Sleep(500);
cout<<"\n对老李造成0点伤害\n";
cout<<"老李:就这?\n";
Sleep(1000);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
else
if(f==3)
{
cout<<"你使用了低价广播\n";
Sleep(500);
cout<<"\n发布了此变身器以0.01元出售的消息\n";
Sleep(500);
cout<<"老李用0.01元购买了你的变身器" ;
Sleep(1000);
cout<<"然后老李使用了闪电五连鞭\n";
cout<<"你的血量:100";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
}
else
if(e==2)
{
cout<<"你:老李,你烂骗无辜应是死罪,你可知罪\n";
Sleep(1000);
cout<<"你:我承认你是妖\n";
Sleep(500);
cout<<"你:但妖和人一样,也要有一颗仁慈之心\n";
Sleep(1000);
cout<<"你:当妖有了仁慈之心\n";
Sleep(500);
cout<<"你:妖便不再是妖\n";
Sleep(1000);
cout<<"你:是人妖!\n";
Sleep(500);
cout<<"你:所以我现在要……";
Sleep(500);
cout<<"老李使用了闪电五连鞭\n";
cout<<"你的血量:100\n";
Sleep(500);
cout<<" 一鞭-20\n";
Sleep(500);
cout<<" 二鞭-20\n";
Sleep(500);
cout<<" 三鞭-20\n";
Sleep(500);
cout<<" 四鞭-20\n";
Sleep(1000);
cout<<" 五鞭-20\n";
cout<<"你死了";
cout<<"游戏结束" ;
Sleep(10000);
return 0;
}
}
else
if(d==3)
{
cout<<"你购买了马保国视频";
cout<<"\n你正在观看马老师视频\n";
cout<<"今天我来教大家怎样打";
Sleep(500);
cout<<"松火痰抖闪电鞭\n";
cout<<"正在学习.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
cout<<"学习成功\n获得技能闪电五连鞭";
cout<<"\n你找到了老李.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
int nixue=100;
int laoli=100;
cout<<"战斗即将开始\n";
Sleep(1000);
cout<<"3\n";
Sleep(1000);
cout<<"2\n";
Sleep(1000);
cout<<"1\n";
Sleep(1000);
cout<<"FIGHT!\n\n";
int suiji;
for(int s=1;s<=10000;s++)
{
cout<<"你的血量"<<nixue<<endl;
cout<<"老李血量"<<laoli<<endl;
if(nixue<=0)
{
cout<<"你死了\n";
cout<<"游戏结束";
Sleep(10000);
return 0;
}
else
if(laoli<=0)
{
cout<<"老李死了\n";
Sleep(500);
cout<<"任务完成!\n";
Sleep(1000);
cout<<"打输去医院,打赢去监狱";
Sleep(500);
cout<<"你进了监狱,你输了";
Sleep(10000);
return 0;
}
else
{
cout<<"请选择技能:1.左正蹬 2.右鞭腿 3.左刺拳 4.松火痰抖闪电鞭\n";
cin>>e;
suiji=rand()%4;
if(e==1)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了左正蹬\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
if(e==2)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了右鞭腿\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
if(e==3)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了左刺拳\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
if(e==4)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了闪电五连鞭\n";
Sleep(500);
cout<<"老李受到了50点伤害\n\n";
laoli-=50;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
}
}
}
else
if(d==4)
{
cout<<"你购买了c++教材\n";
Sleep(1000);
cout<<"好了,教材都买了,就去学习吧!别背着妈妈玩游戏哈!";
cout<<"\n游戏结束" ;
Sleep(10000);
return 0;
}
}
else
{
cout<<"你站到了楼顶,您跳了下去\n";
cout<<"啊" ;
Sleep(500);
cout<<"啊";
Sleep(500);
cout<<"啊\n";
Sleep(500);
cout<<"然后.";
Sleep(500);
cout<<".";
Sleep(500);
cout<<".";
Sleep(500);
cout<<"\n你惊奇的发现\n";
Sleep(1000);
jiankang=-10000;
cout<<"你死了";
cout<< "\n游戏结束";
Sleep(10000);
return 0;
}
}
else
if(b==5)
{
if(regou>0)
{
cout<<"您服用了热狗\n";
cout<<"健康值+40";
jiankang+=40;
regou--;
}
else
{
cout<<"您还没有热狗!\n去超市买一根吧\n";
}
}
}
}
}
else
if(a==3)
{
cout<<"你:你是个骗子,别以为我不知道\n";
cout<<" 你就是个@¥@!¥¥#%%@!#¥%\n";
Sleep(900);
cout<<"老李:...\n";
cout<<"老李挂断了电话.";
Sleep(100);
cout<<".";
Sleep(100);
cout<<".\n";
Sleep(100);
cout<<"又恢复了宁静.";
Sleep(500);
cout<<".";
Sleep(500);
cout<<".";
cout<<"\n\a咚(敲门声)";
cout<<"\n请选择: 1.开门 2.不开\n";
cin>>a;
if(a==1)
{
cout<<"你看到了马保国\n";
Sleep(500);
int nixue=100;
int laoli=100;
cout<<"战斗即将开始\n";
Sleep(1000);
cout<<"3\n";
Sleep(1000);
cout<<"2\n";
Sleep(1000);
cout<<"1\n";
Sleep(1000);
cout<<"FIGHT!\n\n";
int suiji;
int e;
for(int s=1;s<=10000;s++)
{
cout<<"你的血量"<<nixue<<endl;
cout<<"老李血量"<<laoli<<endl;
if(nixue<=0)
{
cout<<"你死了\n";
cout<<"游戏结束";
Sleep(10000);
return 0;
}
else
if(laoli<=0)
{
cout<<"老李死了\n";
Sleep(500);
cout<<"任务完成!\n";
Sleep(1000);
cout<<"打输去医院,打赢去监狱";
Sleep(500);
cout<<"你进了监狱,你输了";
Sleep(10000);
return 0;
}
else
{
cout<<"请选择技能:1.左正蹬 2.右鞭腿 3.左刺拳\n";
cin>>e;
suiji=rand()%4;
if(e==1)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了左正蹬\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
if(e==2)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了右鞭腿\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
if(e==3)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了左刺拳\n";
Sleep(500);
cout<<"老李受到了15点伤害\n\n";
laoli-=15;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
else
if(e==123)
{
cout<<"\n你的回合!";
Sleep(1000);
cout<<"\n你使用了三连击\n";
Sleep(500);
cout<<"老李受到了45点伤害\n\n";
laoli-=45;
if(suiji==0)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左正蹬\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==1)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了右鞭腿\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
else
if(suiji==2)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了左刺拳\n";
Sleep(500);
cout<<"你受到了15点伤害\n";
nixue-=15;
}
if(suiji==3)
{
cout<<"\n\n老李回合!";
Sleep(1000) ;
cout<<"老李使用了闪电五连鞭\n";
Sleep(500);
Sleep(500);
cout<<" 一鞭-10\n";
Sleep(500);
cout<<" 二鞭-10\n";
Sleep(500);
cout<<" 三鞭-10\n";
Sleep(500);
cout<<" 四鞭-10\n";
Sleep(1000);
cout<<" 五鞭-10\n";
cout<<"你受到了50点伤害\n";
nixue-=50;
}
}
}
}
}
else
{
cout<<"\n咚\a\n";
Sleep(500);
cout<<"门被踹开了";
cout<<"你被马老师击杀了";
Sleep(10000);
return 0;
}
}
else
{
cout<<"\n(作者比较懒)";
Sleep(1000);
cout<<"\a由于您的操作错误,程序出现问题,请重启程序\n";
Sleep(10000);
return 0;
}
return 0;
}
//作者微信号18331157738
|