im facing the problem on how to use the ctime random,for loop and array in my assignment..can u help me??the following is the problem statement and the condition..
Problem Statement
Simple Arithmetic Quiz Application! Write a program which has five selections as below:
(1) To register number of participants and name
(2) To set level of difficulty for arithmetic quiz (level: easy, medium, and difficult)
(3) To generate a randomly arithmetic question (default: easy)
(4) To display the participants score, time spend and correctness
(5) To exit
Your program has to ask user to key in the following details:
a) An integer (range from 1 to 5) representing the program menu selection options.
b) An integer (range from 1 to 10 inclusive) representing number of participants (set 10
as maximum, set 1 as default).
c) A character representing the level of difficulty: ‘E’ for easy, ‘M’ for medium, and ‘D’
for difficult.
Level of Difficulty:
• Easy:
i. Generate quiz question within 30 seconds
ii. Set the variable x and y as integer (range from 1 to 10 inclusive)
• Medium:
i. Generate quiz question within 20 seconds
ii. Set the variable x and y as integer (range from 10 to 19 inclusive)
• Difficult:
i. Generate quiz question within 10 seconds
ii. Set the variable x and y as integer (range from 20 to 49 inclusive)
Hints:
* For time, use difftime(time_t, time_t) function and include <ctime> header
* For random number, use rand() and include <cstdlib> header
E.g.
x = rand()% 5, will result x from 0 to 4
x = rand()% 5 + 1, will result x value from 1 to 5
2
d) An integer representing the answer of the quiz question.
e) A character representing to begin the quiz or to withdraw: ‘G’ for go, ‘W’ for
withdraw.
• If ‘G’:
i. Correct answer, get score 1 else score -1
• If ‘W’:
i. Score is 0, time taken is 0s and correctness 0/0
f) A character representing to register new participants after completing quiz for the first
batch of participants: ‘Y’: Re-register new participants, ‘N’: Re-use the existing
participants.
• Loop your program so that the user will be asked to choose the selection menu above
after completes each selection task. Stop the loop only when the user select option 5 for
exit.
• When the user quits the loop, display “Good bye!”
• Quiz question is set randomly for sum, product, difference and modulus
• Your program must contain at least 4 functions excluding the main function.
• Do not use any global variables.
• Include as well necessary input validations/ errors checking in the program.

Recommended Answers

All 2 Replies

"im facing the problem on how to use the ctime random,for loop and array "

Seems more like your having problems using Google,
let me help YOU

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.