#include <iostream>
#include <time.h>
#include <stdio.h>
using namespace Std;
void Main ()
{
int t,num,a,n,i,b;
Srand (Time (NULL));// generate random numbers based on times
for (i=0;i<10;i++)
{
A=rand ()%100;//0-100 a random number assignment
Loop:b=rand ()%100;//0-100 a random number assignment????????
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<<a<< "/" <<b<< "=";
t=a/b;
Break
if (b==0) goto loop;t=a/b;break;
}
Do
{
cin>>num;
if (num==t)
{
cout<< " answer right " <<endl;
}
Else
{
cout<< "The answer is wrong! The correct answer is : "<<t<<endl;
}
}while (num!=t);
}
}
The division will fall into a dead loop, but the answer will not continue.
0-100 of the 10-course arithmetic questions