this is what i did
its very similar to what AV posted
| Turing: |
var number_q : int := 0
var answer : string
var name : string
var points : int := 0
var Q_ 1, Q_ 2, Q_ 3, Q_ 4, Q_ 5, Q_ 6, Q_ 7, Q_ 8, Q_ 9, Q_ 10 : boolean := false
var bank : int := 0
var finish : int := 0
var ch : string (1)
procedure Q1 %ask question 1 if bank is 1
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who replaced David Seaman as England's third choice goalkeeper in the 1990 World Cup squad after Seaman injured his thumb in training?"
put "(a) Yao Ching"
put "(b) Nigel Martyn"
put "(c) Ralph Martyn"
put "(d) Dadvid Pfaff"
loop %If the user gets the answer wrong, this will ask the user to enter an answer again
get answer
case answer of %The case of answer
label "a" :
put "Wrong, Try again"
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
label "b" :
put "Yes you are right"
points := points + 5 %Adding 5 points
exit
label "c" :
put "No"
points := points - 2
label "d" :
put "You are SOOO close!"
label :
put "Choose one of the four options" %If the user types something else
end case
end loop
Q_ 1 := true %Question 1 = true
end Q1
procedure Q2 %ask question 2 if bank is 2
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who was the first black soccer player to win a full England cap?"
put "(a) Viv Anderson"
put "(b) Steve Coppell"
put "(c) Tony Currie"
put "(d) Brian Clough"
loop
get answer
case answer of
label "a" :
put "You got it right!!!"
points := points + 5 %Adding 5 points
exit
label "b" :
put "Wrong"
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
label "c" :
put "Try Again"
points := points - 2
label "d" :
put "No"
points := points - 2
label :
put "Choose one of the four options" %If the user types something else
end case
end loop
Q_ 2 := true %Question 2 = true
end Q2
procedure Q3 %ask question 3 if bank is 3
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Where was the 1986 World Cup held?"
put "(a) Russia"
put "(b) Brazil"
put "(c) Mexico"
put "(d) Canada"
loop
get answer
case answer of
label "a" :
put "Nope"
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
label "b" :
put "Try again"
points := points - 2
label "c" :
put "YES!!"
points := points + 5 %Adding 5 points
exit
label "d" :
put "You are so close....NOT!!"
points := points - 2
label :
put "Chose one of the four choices" %If the user types something else
end case
end loop
Q_ 3 := true %Question 3 = true
end Q3
procedure Q4 %ask question 4 if bank is 4
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who was the last player to captain England before David Beckham?"
put "(a) Martin Knowen"
put "(b) Martin Keown"
put "(c) Nomun Martin"
put "(d) Nathan Martin"
loop
get answer
case answer of
label "a" :
put "No"
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
label "b" :
put "You got it right!!"
points := points + 5 %Adding 5 points
exit
label "c" :
put "Not really"
points := points - 2
label "d" :
put ".........."
points := points - 2
label :
put "Choose the choices from the top" %If the user types something else
end case
end loop
Q_ 4 := true %Question 4 = true
end Q4
procedure Q5 %ask question 5 if bank is 5
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Where was the 1998 World Cup held?"
put "(a) Canada"
put "(b) Germany"
put "(c) France"
put "(d) Britian"
loop
get answer
case answer of
label "a" :
put "Try again"
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
label "b" :
put "NO"
points := points - 2
label "c" :
put "Yes"
points := points + 5 %Adding 5 points
exit
label "d" :
put "NO"
points := points - 2
label :
put "Choose one of the four choices" %If the user types something else
end case
end loop
Q_ 5 := true %Question 5 = true
end Q5
procedure Q6 %ask question 6 if bank is 6
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who scored England's dying seconds winner against Belgium in the 1990 World Cup?"
put "(a) Evtushenko"
put "(b) Pfaff"
put "(c) David Beckham"
put "(d) Pfaff Evtushenko"
loop
get answer
case answer of
label "a" :
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
put "No"
label "b" :
points := points + 5 %Adding 5 points
put "Yes, You got it right"
exit
label "c" :
points := points - 2
put "NOOOOOO!"
label "d" :
points := points - 2
put "NO!!!!"
label :
put "please choose the choices from above" %If the user types something else
end case
end loop
Q_ 6 := true %Question 6 = true
end Q6
procedure Q7 %ask question 7 if bank is 7
finish := finish + 1 %when finish will equal to how many questions the user wants
put "What height and width is a football goal?"
put "(a) 6inch by 8ft"
put "(b) 8ft wide and 8ft tall"
put "(c) 8yrds. and 8ft tall"
put "(d) 10yrds. and 10ft tall"
loop
get answer
case answer of
label "a" :
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
put "No"
label "b" :
points := points - 2
put "Never!"
label "c" :
points := points + 5 %Adding 5 points
put "Yea"
exit
label "d" :
points := points - 2
put "Nope"
label :
put "Please choose the choices from above" %If the user types something else
end case
end loop
Q_ 7 := true %Question 7 = true
end Q7
procedure Q8 %ask question 8 if bank is 8
finish := finish + 1 %when finish will equal to how many questions the user wants
put "From 1980 - 1991 what NATIONAL team was Bryan Robson in?"
put "(a) England"
put "(b) France"
put "(c) Canada"
put "(d) Mexico"
loop
get answer
case answer of
label "a" :
points := points + 5 %Adding 5 points
put "Yup"
exit
label "b" :
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
put "No"
label "c" :
points := points - 2
put "Not even"
label "d" :
points := points - 2
put "NEVER!!"
label :
put "Please choose the choices from above" %If the user types something else
end case
end loop
Q_ 8 := true %Question 8 = true
end Q8
procedure Q9 %ask question 9 if bank is 9
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who did England Defeat to Win the 1966 World Cup?"
put "(a) Germany"
put "(b) East Germany"
put "(c) South Germany"
put "(d) West Germany"
loop
get answer
case answer of
label "a" :
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
put "close"
label "b" :
points := points - 2
put "Nah Bee!!"
label "c" :
points := points - 2
put "No"
label "d" :
points := points + 5 %Adding 5 points
put "Yes, You are right"
exit
label :
put "Please choose the choices from above" %If the user types something else
end case
end loop
Q_ 9 := true %Question 9 = true
end Q9
procedure Q10 %ask question 10 if bank is 10
finish := finish + 1 %when finish will equal to how many questions the user wants
put "Who broke his neck in the 1956 FA Cup Final?"
put "(a) Bret Troff"
put "(b) Bart Tartman"
put "(c) Bret Trautmannt"
put "(d) Bert Trautmann"
loop
get answer
case answer of
label "a" :
points := points - 2 %Reducing the score by 2, if the user gets the question wrong
put "No"
label "b" :
points := points - 2
put "Ha! Tricked You"
label "c" :
points := points - 2
put "NO!"
label "d" :
points := points + 5 %Adding 5 points
put "Yes!"
exit
label :
put "Please choose the choices from above" %If the user types something else
end case
end loop
Q_ 10 := true %Question 10 = true
end Q10
loop
points := points - points %When the program is restarted, points will start from 0 again
finish := finish - finish %This is just for fixing the bug...
colourback (black)
cls
colour (grey)
put "How Well Do You Know Soccer?!!"
put "please introduce yourself"
get name : *
put name, " How many questions do you want to answer? (Max is 10)"
put "The more questions you answer the bigger prize you get!"
put "If you get a question wrong, your score will be subtracted by two and if you getone right you will get 5 points"
get number_q %Getting the number of questions
loop
bank := Rand.Int (1, 10)
if bank = 1 and Q_ 1 = false then %If bank is 1 then ask question 1
Q1
end if
if bank = 2 and Q_ 2 = false then %If bank is 2 then ask question 2
Q2
end if
if bank = 3 and Q_ 3 = false then %If bank is 3 then ask question 3
Q3
end if
if bank = 4 and Q_ 4 = false then %If bank is 4 then ask question 4
Q4
end if
if bank = 5 and Q_ 5 = false then %If bank is 5 then ask question 5
Q5
end if
if bank = 6 and Q_ 6 = false then %If bank is 6 then ask question 6
Q6
end if
if bank = 7 and Q_ 7 = false then %If bank is 7 then ask question 7
Q7
end if
if bank = 8 and Q_ 8 = false then %If bank is 8 then ask question 8
Q8
end if
if bank = 9 and Q_ 9 = false then %If bank is 9 then ask question 9
Q9
end if
if bank = 10 and Q_ 10 = false then %If bank is 10 then ask question 10
Q10
end if
exit when ((Q_ 10 = true) and (Q_ 9 = true) and (Q_ 8 = true) and (Q_ 7 = true) and (Q_ 6 = true) and (Q_ 5 = true) and (Q_ 4 = true) and (Q_ 3 = true) and (Q_ 2 = true) and (Q_ 1 = true))
% When all the questions = true then exit
exit when finish = number_q
end loop
put "And that's it"
put ""
put "You got, ", points, " Points"
if points <= 5 then %Depending on the points of the user, this ;if' statement will decide what the user prize will be
put "We had a lot of fun and guess what, you win 100 dollars"
elsif points > 5 and points <= 10 then
put "We had a great time and You have won a Ps2 with FIFA 09 game"
elsif points > 10 and points <= 20 then
put "You won an Official FIFA Soccer Ball"
elsif points > 20 and points <= 30 then
put "You won a Soccer Jersey"
elsif points > 30 and points <= 40 then
put "You won a Nintendo DS with an EA Replay game!"
elsif points > 40 and points <= 45 then
put "You won a Ps3 and a Xbox 360!"
elsif points > 45 and points <= 50 then
put "You won an Official FIFA Soccer Ball, Soccer Jersey, Ps3 and a Car!!!!!"
end if
put ""
put "Congratulation!!"
put "Play Again (Y for Yes)? " ..
%This is for playing again
getch (ch )
exit when ch not= "Y" and ch not= "y" %If answer is no then exit
end loop
|
procedure is like a shuffle right?
well that's what i think
Mod Edit: Remember to use syntax tags! | code: | [syntax="Turing"]Code Here[/syntax] |
|