#include <iostream>
#include <stdlib.h>
using namespace std;
int main() {
int n,l,a=0;
cout<<"请输入可能随机的最大数:";
cin>>n;
int s=rand()%n;
cout<<endl<<"开始游戏";
while(1){
cout<<endl<<"请猜数:";
cin>>l;
a++;
if(l>s) cout<<"大了";
else if(l<s) cout<<"小了";
else{
cout<<"恭喜,猜了"<<a<<"次";
return 0;
}
}
return 1;
}