Question
Please someone help me with this question Use printf and scanf .................................. 2. Write a program that will help an elementary school student learn multiplication.
Please someone help me with this question
Use printf and scanf
..................................
2. Write a program that will help an elementary school student learn multiplication. Use the random number generator to produce two positive integers between 1 and 12 inclusive. It should then type a question such as:
How much is 6 times 7?
The student then types the answer. Your program checks the students answer. If it is correct, print a message such as Very good! If the answer is wrong, print a message such as No. Please try again. Let the student try the same question again repeatedly until the student gets it right. After the student has answered correctly, ask if the student would like another question. If the student answers y for yes, the student is given another multiplication problem. If the student answers n for no, the program ends.
Use the following structure for your program:
In function main seed the random number generator with the time of day. In a do while loop call a function named multiplication and then ask if the student wants another problem.
In function multiplication generate two random numbers and have the student guess repeatedly until the student answers correctly. Call functions to generate appropriate messages for correct or incorrect answers. Function multiplication has a prototype like the following:
void multiplication (void);
Function correctMessage generates different messages for correct answers. Use the random number generator to choose a number from 1 to 5 to select a response to each answer. Use a switch structure with printf statements to issue the responses. You may make up your own responses. Examples are:
Very good!
Excellent!
Nice work!
Keep up the good work!
Function correctMessage will have a prototype like the following:
void correctMessage(void);
Function incorrectMessage generates different messages for incorrect answers. Use the random number generator to choose a number from 1 to 5 to select a response to each answer. Use a switch structure with printf statements to issue the responses. You may make up your own responses. Examples are:
No. Please try again.
Wrong. Try once more.
Dont give up!
No. Keep trying.
Function incorrectMessage will have a prototype like the following:
void incorrectMessage(void);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started