current position:Home>C language answers for pupils' test

C language answers for pupils' test

2022-01-26 23:55:32 CSDN Q & A

The primary school test is for primary school students 12 Grade students , Randomly select two integers and add and subtract to form a formula. Ask students to answer . Functional requirements :(1) Enter the user name before entering the test 、 Password to login , In order to save student information .(2) Computer random out 10 Problem , Each question 10 branch , Show student scores at the end of the program ;(3) Make sure that the formula does not exceed 12 Grade level , Only... Is allowed 50 Addition and subtraction within , The sum or difference of two numbers is not allowed to exceed 0~50 The scope of the , Negative numbers are not allowed ;(4) For each question, students have three opportunities to enter their answers , When students type in the wrong answer , Remind students to re-enter , If the three chances are over, output the correct answer ;(5) For each question , The first time a student enters the correct answer, he gets 10 branch , The second time you enter the correct answer is 7 branch , The third time you enter the correct answer, you have to 5 branch , Otherwise, no score ;(6) Save the test record to a file , You can check the students' answers , Including scores, etc .(7) Total score 90 The above shows “SMART”,80-90 Show “GOOD”,70-80 Show “OK”,60-70 Show “PASS”,60 following “TRY AGAIN”.(8) Students who fail , It's up to the students to choose whether to do it again , You can redo the previous test volume , You can also choose to make a new set of test papers . There is only one chance to redo .(9) Leaderboard function , The leaderboard displays the user name 、 fraction 、 Question time, etc .

Is there a big man to help this code reference !!!




Refer to the answer 1:

The reference codes are as follows :

#include <stdio.h>#include <stdlib.h>#include <time.h>int main(){    int x, y, z, m, k, c, i, f=0;    srand((unsigned)time(NULL));    for( i=0; i<10; i++ )    {        z = rand() % 21;        x = rand() % z+1;        y = z - x;        m = rand() % 2;        if (m==0)        {            printf("%d + %d = ", x, y);            k = z;        }        else        {            printf("%d - %d = ", z, x);            k = y;        }        scanf("%d", &c);        if(c==k)        {            f += 10;            printf(" Correct answer \n");        }        else        {            printf(" Wrong answer \n");        }    }    printf(" score :%d",f);    return 0;}

If help , Hope to adopt ! thank you !




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262355309444.html

Random recommended