Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how do i put the counting score on a quiz...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CHUTHAN20




PostPosted: Fri May 28, 2004 7:30 pm   Post subject: how do i put the counting score on a quiz...

i made a quiz but I don't know how to count the score. but i want the percentage at the end. plz help me.... Sad
Sponsor
Sponsor
Sponsor
sponsor
naoki




PostPosted: Fri May 28, 2004 7:40 pm   Post subject: (No subject)

Well there's quite a few problems with your program, not just the inability to find out your score

For starters, I'd suggest you put all your questions into a textfile, and read from the textfile for each question. After the potential answers are read in for a question, a number appears right below in the textfile indicating the correct answer. If the player's answer = text answer then he gets a point.

code:

loop
      exit when eof (file)
      for x : 1 .. 4
           get: file, answer(x) : *
      end for
      get: file, correctanswer
      numquestions += 1
      get useranswer
      if useranswer = correctanswer then
           score += 1
      end if
      playeraverage := score/numquestions
end loop


a percentage is rather easy, just think about how you'd normally go about calculating an average mark, and assign variables along your thought process. Use "/" instead of "div" for a more correct average

EDIT: made code a little easier to look at. Basically anything not "if" "then" "for" or "get" is a variable. if you've done enough turing then you should be able to assign variables accordingly.
CHUTHAN20




PostPosted: Fri May 28, 2004 8:27 pm   Post subject: sorry

thanks thats help a little but i don't get it
AsianSensation




PostPosted: Fri May 28, 2004 8:58 pm   Post subject: (No subject)

well, what don't you get?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: