
-----------------------------------
CHUTHAN20
Fri May 28, 2004 7:30 pm

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.... :(

-----------------------------------
naoki
Fri May 28, 2004 7:40 pm


-----------------------------------
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.

 
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
Fri May 28, 2004 8:27 pm

sorry
-----------------------------------
thanks thats help a little but i don't get it

-----------------------------------
AsianSensation
Fri May 28, 2004 8:58 pm


-----------------------------------
well, what don't you get?
