#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
int n,cut=1,a;
cout<<"请输入n的大小:";
cin>>n;
if(n<=10)
{
a=3;
}
else if(n>10&&n<=1000)
{
a=10;
}
else if(n>1000&&n<=10000)
{
a=15;
}
else if(n>10000&&n<=50000)
{
a=20;
}
if(n>50000)
{
a=30;
}
system("CLS");
cout<<"猜数字游戏开始了!";
Sleep(1000);
system("CLS");
cout<<"(请输入"<<n<<"到1的数)"<<endl;
srand((unsigned int)time(NULL));
int s=rand()%n+1;
while(1)
{
int cai;
cin>>cai;
if(cai>s)
{
cout<<"大了"<<endl;
}
else if(cai<s)
{
cout<<"小了"<<endl;
}
else
{
Sleep(1000);
system("CLS");
cout<<"你赢了";
Sleep(1000);
system("CLS");
cout<<"你输了";
system("pause");
if(n<=10)
{
a=3;
}
else if(n>10&&n<=1000)
{
a=10;
}
else if(n>1000&&n<=10000)
{
a=15;
}
else if(n>10000&&n<=50000)
{
a=20;
}
if(n>50000)
{
a=30;
}
system("CLS");
cout<<"猜数字游戏开始了!";
Sleep(1000);
system("CLS");
cout<<"(请输入"<<n<<"到1的数)"<<endl;
srand((unsigned int)time(NULL));
int s=rand()%n+1;
while(1)
{
int cai;
cin>>cai;
if(cai>s)
{
cout<<"大了"<<endl;
}
else if(cai<s)
{
cout<<"小了"<<endl;
}
else
{
Sleep(1000);
system("CLS");
cout<<"你赢了";
08-07
12-16
07-28
837
10-11
1288
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交