#include<bits/stdc++.h>
using namespace std;
int main(){
srand(time(0));
int s=0,d,n=rand()%100+1;
while(1){
system("cls");
s++;
if(s-1==8){
cout<<endl<<endl<<"对不起,";
cout<<endl;
cout<<"您的次数已经达到了,";
cout<<endl;
cout<< "再来一次吧! " <<endl;
cout<<"正确答案是:"<<n<<endl;
break;
}
cout<<endl<<s+1<<' ';
cout<<"请输入一个1-100之间的数:";
cout<<endl;
cin>>d;
if(d>n) cout<<"大了"<<endl;
else if(d<n) cout<<"小了"<<endl;
else if(d==n){
cout<<"恭喜您猜对了"<<endl;break;
}
}
return 0;
}