Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help with programing/dbp

Author
Message
mrmystic
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 02:20
I need help with a simple text study guide I am making for an upcomming exam. What it does is it gives you a qustion with multiple choice answers and you input the answers. My question is I want the program to store my correct wrong and right answers and then disply a percentile grade (ie You scored a 90%) when I am done. How do I go about doing this. Please take it easy on me because I am totally new to programming.
One Common Ruin
20
Years of Service
User Offline
Joined: 19th Jan 2004
Location: United States
Posted: 31st Jan 2004 02:43
I'm would suggest adding to your code like a point system (each question 10pts etc)
See code below:

And at the end add all the points up to get the total score.

Anyway hope that help

Zink
mrmystic
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 09:23
Thanks for the help but it still wasn't quite the answer I was looking for. What I need is some way to take the input from the answers right or wrong and give me a total score at the end of the program that
will display on the screen. I got the idea from when I was in the Air Force and we took our tests on the computer. The program would show you what questions you missed and also displayed your percentile score.
Would I use an array? If so how could I use it in the program? I just know I am stumped on this one.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 31st Jan 2004 12:51
if you have 50 questions in total then divide 100 by 50, giving 2, then allocate 2 points for every correct answer, something like this

blah.......
print "NEXT QUESTION!"
correct=3
print how would you finish the illustrated action?"
print
print "1...3 rubber bands and a greased pole"
print "2...a mud pool and vaseline"
print "3...carefully with a rubber hose and klaxon"
input selection
if selection=correct then points=points+2

then at the end of the program do this

if points<25 then print "you need to return to primer school, you got ",points,"%"
if (points >=25) and (points<75) then print "at least you can cross the road without help!, you got ",points,"%"
if points>=75 then print "intelligent life on Earth?, where did you leave your saucer?, you got ",points,"%"

or maybe something a little more tactful , cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
mrmystic
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 1st Feb 2004 08:49
Thanks Mentor that code worked really well and it was just what I was looking for!
mrmystic
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 2nd Feb 2004 03:59
In your code, every time a question is answered, inc a variable that stores how many questions were asked. If it was the correct answer, increase a variable that stores how many were correct. At the end, divide the correct/total and *100 to the get the percent.

Sorry I am not more detailed, I have to go now.

Good Luck

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]

Login to post a reply

Server time is: 2024-11-26 03:37:26
Your offset time is: 2024-11-26 03:37:26