Current location - Training Enrollment Network - Mathematics courses - Ask c++ to write the source code of primary school students' mathematics examination software.
Ask c++ to write the source code of primary school students' mathematics examination software.
//# contains? & ltstdlib.h & gt

# Contains? & ltiostream & gt

Use? Namespace? std

int? Master ()

{

int? I,j,k,l=0,n;

cout & lt& lt* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * & lt; endl

Cout & lt& lt "Please select the question type you want to test: 1. +? 2.-? 3.*? 4./:";

CIN & gt; & gt me;

if(i== 1)

{

Cout & lt& lt Please enter the number of test questions:

CIN & gt; & gtj;

for(int? k 1 = 0; k 1 & lt; j; k 1++)

{

Srand ((unsigned) time (empty));

int? x 1 = rand()% 100;

int? x2 = rand()% 100; ?

cout & lt& ltx 1 & lt; & lt"+" & lt; & ltx2 & lt& lt"=:";

CIN & gt; & gtk;

if(k==x 1+x2){

Cout & lt& lt "Correct answer!" & lt& ltendl?

l++;

}

other

Cout & lt& lt "Wrong answer! The correct answer is: "

}

}

Or what? If (i==2)

{

Cout & lt& lt Please enter the number of test questions:

CIN & gt; & gtj;

for(int? k 1 = 0; k 1 & lt; j; k 1++)

{

Srand ((unsigned) time (empty));

int? x 1 = rand()% 100;

int? x2 = x 1+rand()% 50; ?

cout & lt& ltx2 & lt& lt“-”& lt; & ltx 1 & lt; & lt"=:";

CIN & gt; & gtk;

if(k==x2-x 1){

Cout & lt& lt "Correct answer!" & lt& ltendl?

l++;

}

other

Cout & lt& lt "Wrong answer! The correct answer is: "

}

}

Or what? If (i==3)

{

Cout & lt& lt Please enter the number of test questions:

CIN & gt; & gtj;

for(int? k 1 = 0; k 1 & lt; j; k 1++)

{

Srand ((unsigned) time (empty));

int? x 1 = rand()% 100;

int? x2 = rand()% 100; ?

cout & lt& ltx 1 & lt; & lt" * " & lt& ltx2 & lt& lt"=:";

CIN & gt; & gtk;

if(k==x 1*x2){

Cout & lt& lt "Correct answer!" & lt& ltendl?

l++;

}

other

Cout & lt& lt "Wrong answer! The correct answer is: "

}

}

Or what? If (i==4)

{

Cout & lt& lt Please enter the number of test questions:

CIN & gt; & gtj;

for(int? k 1 = 0; k 1 & lt; j; k 1++)

{

Srand ((unsigned) time (empty));

int? x 1 = rand()% 100+ 1;

int? x2 = x 1 *(rand()% 10); ?

cout & lt& ltx2 & lt& lt“/”& lt; & ltx 1 & lt; & lt"=:";

CIN & gt; & gtk;

if(k==x2/x 1){

Cout & lt& lt "Correct answer!" & lt& ltendl?

l++;

}

other

Cout & lt& lt "Wrong answer! The correct answer is: "

}

}

Cout & lt& lt "How many questions did you answer correctly in this test?"

Cout & lt& lt "Continue testing: 0. Quit 1. Continue: ";

CIN & gt; & gtn;

if(n== 1){

Return? main(); }

//system(" PAUSE ");

Return? 0;

}

There should be no mistakes in testing several times!