#include #include<windows.h> #include<time.h> using namespace std;
int main() { srand(time(0)); int a = rand()%100+1; int cnt=0; int n; int y; int t=10; int z=3,b=1,c=10000; cout<<" "<<"欢迎来到L3(5.0)官方版猜数游戏"<<endl; cout<<" "<<"请输入您的游戏密码"<<"您一共有"<<z<<"次机会"<<endl; cout<<"密码:"<<endl; while(1){ cin>>y; if(y == 123456){ cout<<"密码正确,开始游戏!"<<endl; break; } if(y != 123456){ z = z - 1; cout<<"密码错误,您还剩"<<z<<"次机会"<<endl; cout<<"密码:"<<endl; } if(z == 0){ if(t--){ cout<<t<<endl; Sleep(1000); } break; } } while(1){ cout<<"请输入1~100随机一个数:"<<endl; cin>>n; if(n > a){ cout<<"对不起,数字大了"<<endl; } if(n < a){ cout<<"对不起,数字小了"<<endl; } if(n == a){ cout<<"恭喜您,猜对了"<<endl; break; } } cout<<"哎呀!你的电脑崩溃了!"<<endl; while(c--){ cout<<b; } while(t--){ cout<<t<<" "<<"无语"<<"......"<<endl; Sleep(1000); } cout<<"下次再玩吧!拜拜"<<endl; cout<<"主编:cyx"<<" "<<"副编:zyl"<<endl; return 0; }
共 1 条回复
wyy,jbl,sqlm