| | |
how to use ctime ,random function,for loop and array???
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2009
Posts: 1
Reputation:
Solved Threads: 0
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.
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.
We only give homework help to those who show effort
Didn't you see this in your rush to post your homework.
Didn't you see this in your rush to post your homework.
"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
Seems more like your having problems using Google,
let me help YOU
I give up! 1) What word becomes shorter if you add a letter to it? [ Solved by : niek_e ] 2) What does this sequence equal to : (.5u - .5a)(.5u-.5b)(.5u-.5c) ... 3) What is the 123456789 prime numer? Ask4Answer
![]() |
Similar Threads
- how to make random function in c++? (C++)
- Random no. function dispays the same number (C++)
- Problem with random function (C++)
- How do i want to create random number for dynamic array variables ? (Visual Basic 4 / 5 / 6)
- Random number generation from an array without repeats (C)
- Array with random function (C++)
- random numbers, and 2 dimensional array (C++)
- JAVA Expert Help me.. Write a function that accepts an array of integers and returns (Java)
- random function generator (C)
Other Threads in the C++ Forum
- Previous Thread: Need help on Patterns
- Next Thread: Problem with typedef inside namespace
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion convert count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






