#include<iostream>
#include<cstdlib>
using namespace std;
void fuhao(int x)
{
if(x==0) printf("+");
if(x==1) printf("-");
if(x==2) printf("*");
}
int main()
{
int a,b,t,p,flag;
int score=0;
int n,i;
loop :
system("cls");
cout<<"您要答多少題?"<<endl;
cin>>n;
cout<<"開始進入測試!"<<endl;
for(i=0;i<n;i++)
{
cout<<"第"<<i+1<<"題:"<<endl;
a=rand()%10;
b=rand()%10;
if(a<b)
flag=rand()%3;
cout<<a;
fuhao(flag);
cout<<b<<" = ";
cin>>t;
if(flag==0)
{
if(t==a+b)
else cout<<"答錯了!正確答案是: "<<a+b<<endl;
}
if(flag==1)
{
if(t==a-b)
else cout<<"答錯了!正確答案是: "<<a-b<<endl;
}
if(flag==2)
{
if(t==a*b)
else cout<<"答錯了!正確答案是: "<<a*b<<endl;
}
}
cout<<"做對題目的總個數為: "<<score<<endl;
cout<<"是否繼續?1.繼續2.退出"<<endl;
cin>>t;
if(t==1)goto loop;
else cout<<"歡迎使用!再見!"<<endl;
system("pause");
return 1;
}