#include<iostream>
#include<ctime>
using namespace std;
main(){
int t1,t2,num,a[10],i,t=0,j,b[10];
srand(time(0));
cout<<"小学生十个问题,要计分的奥"<<endl;
for(i=0;i<10;i++)
{
t1=rand()%10;
t2=rand()%10;
if(t1>t2){
a[i]=t1-t2;
cout<<t1<<"-"<<t2<<"="<<endl;
}else{
a[i]=t1+t2;
cout<<t1<<"+"<<t2<<"="<<endl;
}
}
cout<<"请输入上面十个题的答案"<<endl;
for(j=0;j<10;j++){
cin>>b[j];
if(a[j]==b[j])
t+=10;
else
t-=10;
}
cout<<endl;
cout<<"你的最后总得分是"<<t<<"分"<<endl;
return 0;
}
运行结果: