Different Questions in True/False Quiz (Parallel Get)
Author |
Message |
Rom
|
Posted: Tue Jan 16, 2007 11:12 am Post subject: Different Questions in True/False Quiz (Parallel Get) |
|
|
Hello everyone,
I was wondering how to get different questions in parralelget
Here's my code:
code: | var x : int
put "1. A standard guitar has 5 strings."
loop
x := parallelget
if x = 88 then
locate(2,1)
put "True"
Music.PlayFile ("T0386900.wav")
locate(3,1)
put "Incorrect!"
delay (200)
Music.PlayFile ("I0091600.wav")
end if
if x = 248 then
locate(2,1)
put "False"
Music.PlayFile ("F0023700.wav")
locate(3,1)
put "Correct!"
delay (200)
Music.PlayFile ("C0659000.wav")
end if
end loop
|
How do I add more questions?
Thanks alot. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
aznrex
|
Posted: Tue Jan 16, 2007 10:15 pm Post subject: Re: Different Questions in True/False Quiz (Parallel Get) |
|
|
use
if
elsif
end if |
|
|
|
|
![](images/spacer.gif) |
Rom
|
Posted: Tue Jan 16, 2007 11:09 pm Post subject: Re: Different Questions in True/False Quiz (Parallel Get) |
|
|
aznrex @ Tue Jan 16, 2007 10:15 pm wrote: use
if
elsif
end if
Hello,
I tried it but it won't work because the loop of parallelget gets on one place and doesn't move to the other question. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Wed Jan 17, 2007 12:16 am Post subject: RE:Different Questions in True/False Quiz (Parallel Get) |
|
|
Why are you usin parallel get? isn't that for peripherals? |
|
|
|
|
![](images/spacer.gif) |
Rom
|
Posted: Wed Jan 17, 2007 7:45 am Post subject: Re: Different Questions in True/False Quiz (Parallel Get) |
|
|
I need it for a project.
Anyone knows? |
|
|
|
|
![](images/spacer.gif) |
Rom
|
Posted: Wed Jan 17, 2007 8:17 pm Post subject: RE:Different Questions in True/False Quiz (Parallel Get) |
|
|
Anyone?
Or is there a different way to add more questions?
Thanks. |
|
|
|
|
![](images/spacer.gif) |
Rom
|
Posted: Thu Jan 18, 2007 11:34 am Post subject: RE:Different Questions in True/False Quiz (Parallel Get) |
|
|
Here's my new code but it still doesn't work
code: |
process main
var counter : int
put "1. A standard guitar has 5 strings."
counter := 1
locate(4,1)
put "2. Say TRUE."
counter := 2
end main
process check
var x : int
var x2 : int
loop
x := parallelget
x2 := parallelget
if x = 88 then
locate(2,1)
put "True"
Music.PlayFile ("T0386900.wav")
locate(3,1)
put "Incorrect!"
delay (200)
Music.PlayFile ("I0091600.wav")
elsif x = 248 then
locate(2,1)
put "False"
Music.PlayFile ("F0023700.wav")
locate(3,1)
put "Correct!"
delay (200)
Music.PlayFile ("C0659000.wav")
end if
if x2 = 248 then
locate(5,1)
put "True"
Music.PlayFile ("T0386900.wav")
locate(6,1)
put "Incorrect!"
delay (200)
Music.PlayFile ("I0091600.wav")
elsif x2 = 88 then
locate(5,1)
put "False"
Music.PlayFile ("F0023700.wav")
locate(6,1)
put "Correct!"
delay (200)
Music.PlayFile ("C0659000.wav")
end if
end loop
end check
fork check
fork main
|
Anyone? ![Sad Sad](http://compsci.ca/v3/images/smiles/icon_sad.gif) |
|
|
|
|
![](images/spacer.gif) |
vertozia
|
Posted: Thu Jan 18, 2007 3:29 pm Post subject: RE:Different Questions in True/False Quiz (Parallel Get) |
|
|
umm thats strange, id id my multiple choice questions in a different way using if, i dont know why you used procedures, that makes it much harder, even for score keeping. another alternative is labels, but you cant keep a ascore either.
look at this:
code: | setscreen ("graphics:690,650")
colorback (black)
cls
color (brightgreen)
var sel1:int
loop
cls
color (yellow)
put " MULTIPLE CHOICES "
put skip
color (brightgreen)
put " Question 1 - What is the area"
put " of a square with a lenght of 4 cm"
put " 7cm and a width of 4cm?"
put skip
Draw.Box (350, 600, 543, 550, white)
put " 7 cm"
color (brightred)
put " 1) 28cm"
put " 2) 56m "
put " 3) 17cm"
put " 4) 17m"
put skip
color (brightpurple)
put "Answer:" ..
color (77)
get sel1
if sel1 = 1 then
put "YOU ARE CORRECT!"
delay (500)
elsif sel1 = 2 or sel1 = 3 or sel1 = 4 then
put "YOU ARE INCORRECT!"
delay (500)
else
put "PLEASE MAKE A CHOICE"
delay (500)
end if
exit when sel1 = 1
end loop
delay (300) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Thu Jan 18, 2007 4:25 pm Post subject: Re: Different Questions in True/False Quiz (Parallel Get) |
|
|
why not use functions that return a boolean value?
Turing: |
fcn correct (true_answer, given_answer : string) : boolean
result true_answer = given_answer
end correct
procedure ask_question (question, answer : string, allowed_tries : int)
var guess : string
for i : 1 .. allowed_tries
put question
get guess :*
if correct (answer, guess) then
%do whatever
end if
end for
put "Sorry, out of tries"
end ask_question
|
![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|