Current location - Training Enrollment Network - Mathematics courses - Compilation of Math Examination Software for Primary School Students
Compilation of Math Examination Software for Primary School Students
# include & ltstdio.h & gt

# include & ltmath.h & gt

# include & ltstdlib.h & gt

main(){

int n,m,k,s,t,tmp,sum= 10,I,dui=0,CuO = 0;

printf("-\ n ");

Printf ("Please select a type: \ n");

printf(" 1:+\ n ");

printf(" 2:-\ n ");

printf(" 3:* \ n ");

printf(" >);

scanf("%d ",& ampn);

printf("-\ n ");

Printf ("How many themes to do: \ n");

printf(" >);

scanf("%d ",& ampsum);

printf("-\ n ");

for(I = 1; I<= sumi++){

m = rand();

m =(int)( 10.0 * RAND()/(RAND _ MAX+ 1.0));

k = rand();

k =(int)( 10.0 * RAND()/(RAND _ MAX+ 1.0));

Switch (n)

Case 1:

printf("%d+%d= ",m,k);

scanf("%d ",& amps);

t = m+k;

if(t==s){

Printf ("Your result is true! \ n ");

dui++;

} Otherwise {

Printf ("Your results are false! \ n ");

Printf ("The correct result is: %d\n", t);

cuo++;

}

Break;

Case 2:

If (m & ltk){

tmp = m;

m = k;

k = tmp

}

printf("%d-%d= ",m,k);

scanf("%d ",& amps);

t = m-k;

if(t==s){

Printf ("Your result is true! \ n ");

dui++;

} Otherwise {

Printf ("Your results are false! \ n ");

Printf ("The correct result is: %d\n", t);

cuo++;

}

Break;

Case 3:

printf("%d*%d= ",m,k);

scanf("%d ",& amps);

t = m * k;

if(t==s){

Printf ("Your result is true! \ n ");

dui++;

} Otherwise {

Printf ("Your results are false! \ n ");

Printf ("The correct result is: %d\n", t);

cuo++;

}

Break;

Default value:

Printf ("Choose the right type!" );

Break;

}

}

printf("-\ n ");

printf("result:true(%d),false(%d)\n ",dui,CuO);

}