c++核弹避难

#include<bits/stdc++.h>

#include<windows.h>

using namespace std;

int a,zs;

int shiwu=5,shui=5;

int j=7,k=3;

int xy;

int main(){

srand((int)time(0));

cout<<"核弹爆炸的前一秒,你来到了地下安全室......";

Sleep(1010);

system("cls");

zs=rand()%10+41;

for(int i=1;zs>0;i++,zs--)

{

system("cls");

cout<<"第"<<i<<"天"<<endl;

Sleep(1000);

if(shiwu>=1) shiwu--;

else j--;

if(shui>=1) shui--;

else k--;

if(j<=0||k<=0)

{

if(j<=0)

{

cout<<"你被饿死了"<<endl;

Sleep(1000);

}

else

{

cout<<"你被渴死了"<<endl;

Sleep(1000);

}

return 0;

}

else

{

cout<<"食物:"<<shiwu<<endl;

cout<<"水:"<<shui<<endl;

cout<<"请选择:"<<endl;

cout<<"1.上陆地探险"<<endl;

cout<<"2.发送求救信号"<<endl;

cin>>a;

if(a==1)

{

xy=rand()%7+1;

if(xy==1)

{

cout<<"你被核辐射弄死了"<<endl;

return 0;

}

else

{

int s,u;

s=rand()%4;

u=rand()%4;

if(s!=0&&u!=0)

{

shiwu+=s;

shui+=u;

cout<<"你找到了"<<s<<"份食物"<<endl;

Sleep(1050);

cout<<"你找到了"<<u<<"瓶水"<<endl;

Sleep(3000);

}

else if(s!=0)

{

shiwu+=s;

shui+=u;

cout<<"你找到了"<<s<<"份食物"<<endl;

Sleep(1050);

cout<<"你没找到水"<<endl;

Sleep(3000);

}

else if(u!=0)

{

shiwu+=s;

shui+=u;

cout<<"你没有找到食物"<<endl;

Sleep(1050);

cout<<"你找到了"<<u<<"瓶水"<<endl;

Sleep(3000);

}

else

{

cout<<"什么也没找到"<<endl;

Sleep(3000);

}

}

}

else if(a==2)

{

xy=rand()%3+1;

if(xy<=2)

{

cout<<"求救信号似乎没有奏效"<<endl;

Sleep(3000);

}

else

{

int zx=rand()%2+1;

cout<<"求救信号似乎奏效了"<<endl;

zs-=zx;

Sleep(3000);

}

}

else return 0;

}

}

cout<<"你被救援队发现,救了下来"<<endl;

cout<<"胜利";

Sleep(2005);

return 0;

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值