数字炸弹小游戏:李昱辰,1.0版本
#include<iostream>
#include<windows.h>
#include<conio.h>
#include <cstdlib>
#include<ctime>
using namespace std;
int main()
{
cout<<"正在加载中";
Sleep(2000);
system("cls");
cout<<"loading";
Sleep(5000);
system("cls");
cout<<"游戏更新说明:本游戏版权为李昱辰所有"<<endl;
cout<<"目前版本:1.0版本"<<endl;
cout<<"更新内容:无"<<endl;
cout<<"知道请输入1"<<endl;
char a=_getch();
int b=a-'0';
if(b==1){
system("cls");
cout<<"正在解压中 "<<endl;
Sleep(2000);
system("cls");
cout<<"\r欢迎来到数字炸弹"<<endl;
Sleep(1000);
while(true){
system("cls");
cout<<"按下1:经典模式(单人)"<<endl;
cout<<"按下2:游戏规则"<<endl;
cout<<"按下3:退出游戏"<<endl;
char c=_getch();
int d=c-'0';
if(d==1){
while(true){
system("cls");
cout<<"按下1:1——100,难度:简单"<<endl;
cout<<"按下其余任意键:退出"<<endl;
char f=_getch();
int g=f-'0';
if(g!=1){
break;
}
if(g==1){
system("cls");
Sleep(2000);
cout<<"机器人已经想好炸弹"<<endl;
srand(time(0));
int bomb=rand()%100+1;
Sleep(1000);
while(true){
cout<<"请输入数字:"<<endl;
int number;
cin>>number;
if(number==bomb){
system("cls");
cout<<"恭喜你挑战成功了!!!"<<endl;
cout<<"炸弹:"<<bomb<<endl;
Sleep(5000);
break;
}
if(number>100||number<0){
system("cls");
cout<<"不许糊弄!!!"<<endl;
cout<<"这是给你的惩罚!!!"<<endl;
Sleep(5000);
break;
}
if(number>bomb){
cout<<"大了"<<endl;
Sleep(500);
system("cls");
}
if(number<bomb){
cout<<"小了"<<endl;
Sleep(500);
system("cls");
}
}
}
}
}
else if(d==2){
while(true){
system("cls");
cout<<"数字炸弹:从规定的范围内随机抽选一个数"<<endl;
cout<<"你需要输入数字,减小范围,最终找到那个数字炸弹获得胜利"<<endl;
cout<<"请按0返回上一级"<<endl;
char e=_getch();
if(e=='0'){
break;
}
}
}
else if(d==3){
return 0;
}
}
}
if(b!=1){
return 0;
}
return 0;
}
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐



所有评论(0)