Posted: Sun Mar 28, 2010 11:44 am Post subject: two questions
HEy all i got two questions for you all involving how to do something
first off i have a program that is a 5 question quiz. I want to add a couple of sound clips depending on how the user did. this leads me to the second point. How do i track how many questions the user got right and how many they didnt?
here is the program...
Turing:
var a1 :string var a2 :string var a3 :string var a4 :int var a5 :string var a6 :string
loop put"Welcome to THE QUIZ!" colour(yellow) put" Question 1. Who is the greatest person ever? "..
get a1
if a1 ="Barney"then colour(green) put" " put"That is correct! Barney is the greatest person ever!" else colour(red) put" " put"Im sorry, Barney is the correct answer not ", a1
endif
colour(yellow) put" " put" Question 2. What is the name of the best band ever? "..
get a2
if a2 ="GunsNRoses"then colour(green) put" " put"That is correct! Guns N Roses is the greatest band ever!" else colour(red) put" " put"Im Sorry, GunsNRoses is the correct answer, not ", a2
endif
colour(yellow) put" " put" Question 3. What Operating system do you use? "..
get a3
if a3 ="vista"then colour(green) put" " put"Thats right! You use Vista! Join the club!" else colour(red) put" " put"No you use vista silly! Not ", a3
endif
colour(yellow) put" " put" Question 4. How old are you? You cant get this wrong! "..
get a4
if a4 <= 16then colour(green) put" " put"You are in the 15 and under age group!" else colour(green) put"You are in the 17 and older age group!" endif
colour(yellow) put" " put" Question 5. The greatest man alive made this quiz. Who is he? "..
get a5
if a5 ="Curtis"then colour(green) put" " put"Thats correct! Curtis Gaunt is the greatest man alive!" else colour(red) put" " put"No, no, no! Curtis is the greatest man alive, not ", a5
endif
colour(blue) put"Thanks for playing! Would you like to play again? "..
get a6
exitwhen a6 ="no" endloop
all help appreciated!
Sponsor Sponsor
livingheaven
Posted: Sun Mar 28, 2010 11:49 am Post subject: Re: two questions
have 2 totals
var t1 ,t2,tt : int := 0
then when the user gets something wrong
t2 := t2 +1
and when the user gets something right
t1 := t1 + 1
to see how the user did you can do
tt := t1+t2
if t1 >= 50 then
put "you have passed the quiz."
Music.PlayFileReturn("the music you want to play")
elsif t1 < 50 then
put "you have failled the quiz."
Music.PlayFileReturn("the music you want to play")
hope this helps
GL
livingheaven
Posted: Sun Mar 28, 2010 11:51 am Post subject: Re: two questions
sry ... forgot to end if
4sak3nX
Posted: Sun Mar 28, 2010 11:53 am Post subject: RE:two questions
ok ill try this out and get back to you.
4sak3nX
Posted: Mon Mar 29, 2010 9:14 am Post subject: RE:two questions
ok the counting works fine but the sound wont play.
i put the sound name into the brackets under quotations but it wont play.
USEC_OFFICER
Posted: Mon Mar 29, 2010 11:49 am Post subject: RE:two questions
Are they in the same location?/The folder they are in is in the same location. That's very important. Did you try it with single/double quotations?
4sak3nX
Posted: Tue Mar 30, 2010 9:09 am Post subject: RE:two questions
Turing:
var a1 :string var a2 :string var a3 :string var a4 :int var a5 :string var a6 :string var t1, t2, tt :int:=0
loop colour(yellow) put"Welcome to THE QUIZ!" colour(yellow) put" Question 1. Who is the greatest person ever? "..
get a1
if a1 ="Barney"then colour(green) put" " put"That is correct! Barney is the greatest person ever!"
t1 := t1 + 1 else colour(red) put" " put"Im sorry, Barney is the correct answer not ", a1
t2 := t2 + 1 endif
colour(yellow) put" " put" Question 2. What is the name of the best band ever? "..
get a2
if a2 ="GunsNRoses"then colour(green) put" " put"That is correct! Guns N Roses is the greatest band ever!"
t1 := t1 + 1 else colour(red) put" " put"Im Sorry, GunsNRoses is the correct answer, not ", a2
t2 := t2 + 1 endif
colour(yellow) put" " put" Question 3. What Operating system do you use? "..
get a3
if a3 ="vista"then colour(green) put" " put"Thats right! You use Vista! Join the club!"
t1 := t1 + 1 else colour(red) put" " put"No you use vista silly! Not ", a3
t2 := t2 + 1 endif
colour(yellow) put" " put" Question 4. How old are you? You cant get this wrong! "..
get a4
if a4 <= 16then colour(green) put" " put"You are in the 15 and under age group!"
t1 := t1 + 1 else colour(green) put"You are in the 17 and older age group!"
t1 := t1 + 1 endif
colour(yellow) put" " put" Question 5. The greatest man alive made this quiz. Who is he? "..
get a5
if a5 ="Curtis"then colour(green) put" " put"Thats correct! Curtis Gaunt is the greatest man alive!"
t1 := t1 + 1 else colour(red) put" " put"No, no, no! Curtis is the greatest man alive, not ", a5
t2 := t2 + 1 endif
colour(blue) put"Thanks for playing! Would you like to play again? "..
get a6
exitwhen a6 ="no" endloop
thats what i have and both sounds are on my desktop
chrisbrown
Posted: Tue Mar 30, 2010 10:02 am Post subject: RE:two questions
Windows hides extensions by default. You need to add .mp3 (or .wav, depending on the file you're using) to your filenames.
Sponsor Sponsor
SNIPERDUDE
Posted: Tue Mar 30, 2010 12:05 pm Post subject: RE:two questions
Incorrect, AC/DC is the greatest band ever.
USEC_OFFICER
Posted: Tue Mar 30, 2010 3:34 pm Post subject: RE:two questions
Do you really need seperate strings for each answer? tt doesn't seem to do anything as well. Just pointing that out.
DemonWasp
Posted: Tue Mar 30, 2010 8:00 pm Post subject: RE:two questions
Apparently people who are 16 years old are in the "15 and younger" age group.
USEC_OFFICER
Posted: Tue Mar 30, 2010 8:10 pm Post subject: RE:two questions
How can you be the greatest man alive, and barney is the greatest person ever? There, I've run circles around you logically.
SNIPERDUDE
Posted: Tue Mar 30, 2010 9:13 pm Post subject: RE:two questions
Maybe a quiz with better questions and a four options per question would have been better. But rather than dwell on past projects of such simplicity try expanding your current know-how. Why not try some graphics?
USEC_OFFICER
Posted: Wed Mar 31, 2010 11:43 am Post subject: RE:two questions
How about a simple scrolling game to start out with? It's very simple, yet looks good and professional.
4sak3nX
Posted: Wed Mar 31, 2010 1:07 pm Post subject: RE:two questions
first off this isnt suposed to be logical. I mad it like this. Second its for school so all you are saying about what i should add content wise is completely wasted. It won change. Thank you for the help about the sound though.