#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int a,b,c,d,e,s;
cout<<"你做几道题:";
cin>>c;
cout<<endl;
for(int i=0;i<c;i++){
srand(time(0));
a=rand()%90;
b=rand()%90;
if(a<20){
a=+20;
}else{
a=a;
}
if(b<20){
b=+20;
}else{
b=b;
}
d=a+b;
cout<<a<<"+"<<b<<"是多少:"<<endl;
cin>>e;
if(d==e){
cout<<"答对了"<<endl;
s++;
}else{
cout<<"答不对了"<<endl;
}
}
if(c*0.9<s){
cout<<"优秀!";
}else if(c*0.6>s){
cout<<"不及格** 王华立骂你:“saonimaleigebi***************”";
}
return 0;
}
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
while(1<2==true){
srand(time(0));
int a=rand()%6;
int b;
cin>>b;
if(a==b){
cout<<"中奖了"<<endl;
}else{
cout<<"没中奖"<<endl;
}
cout<<"中奖是:"<<a<<endl;
}
return 0;
}
标签:rand,cout,int,cin,else,中奖,include From: https://www.cnblogs.com/wanghuali2/p/17398039.html