how to use ctime ,random function,for loop and array???

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2009
Posts: 1
Reputation: chelseagoo is an unknown quantity at this point 
Solved Threads: 0
chelseagoo chelseagoo is offline Offline
Newbie Poster

how to use ctime ,random function,for loop and array???

 
0
  #1
Aug 31st, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: how to use ctime ,random function,for loop and array???

 
0
  #2
Aug 31st, 2009
We only give homework help to those who show effort
Didn't you see this in your rush to post your homework.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1,180
Reputation: firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice 
Solved Threads: 147
firstPerson's Avatar
firstPerson firstPerson is offline Offline
Veteran Poster

Re: how to use ctime ,random function,for loop and array???

 
0
  #3
Aug 31st, 2009
"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
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC