#include<iostream>
#include<time.h>#include<stdlib.h>using namespace std;void main(){ int t,num,a,n,i,b,k,s,r;int score=0;cout<<" "<<endl; srand(time(NULL));for(i=1;i<=30;i++){ a=rand()%100;loop: b=rand()%100;n=rand()%4;switch(n){ case 0:cout<<""<<i<<""<<endl;cout<<a<<"+"<<b<<"="; t=a+b;break;case 1:cout<<""<<i<<""<<endl; cout<<a<<"-"<<b<<"="; t=a-b; break;case 2:cout<<""<<i<<""<<endl; cout<<a<<"*"<<b<<"="; t=-a*b; break;case 3:cout<<""<<i<<""<<endl; cout<<""<<i<<""<<endl;cout<<a<<"/"<<b<<"=";if(b==0) goto loop; t=a/b; break;}int cnt=3;do{ cin>>num;if(num==t){ cout<<"正确"<<endl;}else{ if(cnt<3)cout<<"错误"<<endl;cout<<"你还有"<<3-cnt<<"次答题机会"<<endl;++cnt;}}while(cnt<=3&&num!=t);if(num!=t)cout<<"错误!正确答案是:"<<t<<endl;switch(cnt){ case 1:score+=10;break;case 2:score+=7;break;case 3:score+=5;break;}cout<<"当前分数为"<<score<<endl;}cout<<"最后得分"<<score<<"";}