#include "iostream"
#include "cstring"
#include "cmath"
#include "cstdlib"
#include "ctime"
#include "windows.h"
using namespace std;
int main(void) {
int a;
srand(time(0));
a=rand()%900+100;
int guess=0;
int times=10;
cout<<"Here is guess number game.\n";
cout<<"Kill me or I tell your answer\n";
Sleep(2000);
cout<<"Ok I surrender your,Here is the answer:";
cout<<a<<endl;
while(times--){
cin>>guess;
if(guess>a){
cout<<"bigger\n";
}else if(guess<a){
cout<<"lesser\n";
}else{
break;
}
cout<<"left times:"<<times<<endl;
}
if(times==-1){
cout<<"Sorry Bye bye!";
}else{
cout<<"Great! Costed:"<<10-times;
}
return 0;
}
猜数字小游戏2010年杭电笔试第一题
最新推荐文章于 2024-07-25 12:39:48 发布