| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

DO IT YOURSELF !

#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;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
int s=0,d,n;
cin>>n;
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;
}

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
srand(time(0));
int s=1,d,n=rand()%100+1;
while(1){
system("cls");
if(s==10){
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;
Sleep(1000);
s++;
}
return 0;
}
• 7
• 1/1页
• 1