#include<iostream> |
#include<iomanip> |
#include<ctime> |
using namespace std; |
int add_test(){ |
int x,y,z,f,c=0,score=0; |
time_t t; |
srand ( time (&t)); |
f= rand ()%51; |
cout<< "加法测验(共 n 题)" <<endl; |
for ( int i=0;i<=f;i++){ |
c++; |
x= rand ()%21; |
y= rand ()%21; |
cout<<c<< "、" <<setw(2)<<x<< " + " <<setw(2)<<y<< " = " ; |
cin>>z; |
if (x+y==z) |
score += 10; |
} |
return score; |
} |
int sub_test(){ |
int x,y,z,f,c=0,score=0; |
time_t t; |
srand ( time (&t)); |
f= rand ()%31; |
cout<< "减法测验(共 n 题)" <<endl; |
for ( int i=0;i<=f;i++){ |
c++; |
x= rand ()%51; |
y= rand ()%21; |
cout<<c<< "、" <<setw(2)<<x<< " - " <<setw(2)<<y<< " = " ; |
cin>>z; |
if (x-y==z) |
score += 10; |
} |
return score; |
} |
int chn_test(){ |
int x,y,z,f,c=0,score=0; |
time_t t; |
srand ( time (&t)); |
f= rand ()%21; |
cout<< "乘法测验(共 n 题)" <<endl; |
for ( int i=0; i<=f;i++){ |
c++; |
x= rand ()%21; |
y= rand ()%11; |
cout<<c<< "、" <<setw(2)<<x<< " * " <<setw(2)<<y<< " = " ; |
cin>>z; |
if (x*y==z) |
score += 10; |
} |
return score; |
} |
int chu_test(){ |
int x,y,z,f,c=0,score=0; |
time_t t; |
srand ( time (&t)); |
f= rand ()%11; |
cout<< "除法测验(共 n 题)" <<endl; |
for ( int i=0;i<=f;i++){ |
c++; |
x= rand ()%51; |
y= rand ()%11; |
cout<<c<< "、" <<setw(2)<<x<< " ÷ " <<setw(2)<<y<< "=" << " " ; |
cin>>z; |
if (x/y==z) |
score += 10; |
} |
return score; |
} |
初级程序员
by: 想要吃掉柠檬 发表于:2018-07-05 22:07:50 顶(0) | 踩(0) 回复
好,果然等级太低看不懂,下载看看能不能理解,感谢分享。
回复评论