Home > Back-end >  Please answer
Please answer

Time:09-20

Answer of the c language program problem, how to write?
A total of ten multiplication problem, each for a 10 points, requires two wrong
Question no. 1:4 * 1=4
Answer 4 right
Question no. 2:3 * 3=9
Answer 9 right
Question no. 3:2 * 7=10
The answer is 14 error
Question 4:3 * 2=6
Answer 6 right
Question 5:6 * 1=
Answer 6 right
Question 6:7 * 3=22
The answer is 21 error
.
10 questions: 9 * 0=0
Answer 0
rightTotal: 80

CodePudding user response:

Difference you a way of thinking

https://blog.csdn.net/qq_45861670/article/details/104109693

The main is a random number

CodePudding user response:

The include & lt; Stdio. H>
#include
#include
Int get_random1 (void);
Int get_random2 (void);
Void multitable (int a, int b);
Int input ();
Int main (void) {
Srand (time (NULL));
int sum=0;
Int score=10;
for (int i=1; i <=10; + + I) {
Int in=input ();
Int a=get_random1,
B=get_random2;
Printf (" % d problem: ", I);
Multitable (a, b);
In;
If (a * b==in)
{
Printf (" a shi % d correct. ", in);
The sum +=score;
}
The else printf ("?????? % d??????? ", a * b);
}

Printf ("?? : % d?" , sum);
return 0;
}
Int get_random1 (void) {
Return the rand () % 9 + 1;
}
Int get_random2 (void) {
Return the rand () % 9 + 1;
}
Void multitable (int a, int b) {
{
Printf (" % d % d *=\ n ", a, b);
}
}
Int input (void) {
Int in;
Scanf_s (" % d ", & amp; In);
Return in;
}

CodePudding user response:

The include & lt; Stdio. H>
#include
#include
Int get_random1 (void);
Int get_random2 (void);
Void multitable (int a, int b);
Int input ();
Int main (void) {
Srand (time (NULL));
int sum=0;
Int score=10;
Printf (" *??? ?? * \ n ");
for (int i=1; i <=10; + + I) {
Int in=input ();
Int a=get_random1,
B=get_random2;
Printf (" % d problem: ", I);
Multitable (a, b);
In;
If (a * b==in)
{
Printf (" % d correctly. ", in);
The sum +=score;
}
The else printf (" the answer error % d ", a * b);
}

Printf (" total score: % d ", sum);
return 0;
}
Int get_random1 (void) {
Return the rand () % 9 + 1;
}
Int get_random2 (void) {
Return the rand () % 9 + 1;
}
Void multitable (int a, int b) {
{
Printf (" % d % d *=\ n ", a, b);
}
}
Int input (void) {
Int in;
Scanf_s (" % d ", & amp; In);
Return in;
}

CodePudding user response:

This is our teacher, wrote, but it seems didn't write complete
  • Related