Need Help with my random questions 
	 
	
		| Author | 
		Message | 
	 
		 
		uknowhoiam
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 12:35 am    Post subject: Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I tried so many times but still cant fix this problem, i made a sports trivia game, everything is fine, except the random questions, sometimes the question repeat, anyone out there wanna help me?
 
 
Here's my code so far..
 
 
	  | Turing: | 	 		  
var number_q  : int := 0
var answer  : string
var name  : string
var points  : int := 0
var bank  : int := 0
var finish  : int := 0
var ch  : string (1)
var random  : int := 0
loop %If the user answers yes to play again, this loop will loop the program again"
    points  := points - points
 
    finish  := finish - finish
     colourback (black)
    cls
    colour (green +  1 +  5)
    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
     for count  : 1 ..  10         % This 'for' loops is used for the 10 questions
        bank  := Rand.Int  (1,  10)
        case bank  of            %The case of bank
            label 1 :           %If bank is 1 then..
                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) David James"
                put "(c) Ralph"
                put "(d) Nigel Martyn"
                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            %Subtracting score
                        label "b" :
                            put "Nope"
                            points  := points -  2
                        label "c" :
                            put "No"
                            points  := points -  2
                        label "d" :
                            put "Yes you are right"
                            points  := points +  5
                            exit
                        label :
                            put "Choose one of the four options"
                    end case
                end loop
            label 2 :               %If bank is 2 then..
                finish  := finish +  1
                put "Who was the first black footballer 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
                            exit
                        label "b" :
                            put "Wrong"
                            points  := points -  2
                        label "c" :
                            put "Try Again"
                            points  := points -  2
                        label "d" :
                            put "No"
                            points  := points -  2
                        label :
                            put "Choose one of the four options"
                    end case
                end loop
            label 3 :                   %If bank is 3 then..
                finish  := finish +  1
                put "Where was the 1986 World Cup held?"
                put "(a) Russia"
                put "(b) Brazil"
                put "(c) Canada"
                put "(d) Mexico"
                loop
                    get answer
                     case answer  of
                        label "a" :
                            put "Nope"
                            points  := points -  2
                        label "b" :
                            put "Try again"
                            points  := points -  2
                        label "c" :
                            put "You are so close....NOT!!"
                            points  := points -  2
                        label "d" :
                            put "YES!!"
                            points  := points +  5
                            exit
                        label :
                            put "Chose one of the four choices"
                    end case
                end loop
            label 4 :                   %If bank is 4 then..
                finish  := finish +  1
                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
                        label "b" :
                            put "You got it right!!"
                            points  := points +  5
                            exit
                        label "c" :
                            put "Not really"
                            points  := points -  2
                        label "d" :
                            put ".........."
                            points  := points -  2
                        label :
                            put "Choose the choices from the top"
                    end case
                end loop
            label 5 :                   %If bank is 5 then..
                finish  := finish +  1
                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
                        label "b" :
                            put "NO"
                            points  := points -  2
                        label "c" :
                            put "Yes"
                            points  := points +  5
                            exit
                        label "d" :
                            put "NO"
                            points  := points -  2
                        label :
                            put "Choose one of the four choices"
                    end case
                end loop
            label 6 :                   %If bank is 6 then..
                finish  := finish +  1
                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
                            put "No"
                        label "b" :
                            points  := points +  5
                            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"
                    end case
                end loop
            label 7 :                   %If bank is 7 then..
                finish  := finish +  1
                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
                            put "No"
                        label "b" :
                            points  := points -  2
                            put "Never!"
                        label "c" :
                            points  := points +  5
                            put "Yea"
                            exit
                        label "d" :
                            points  := points -  2
                            put "Nope"
                        label :
                            put "Please choose the choices from above"
                    end case
                end loop
            label 8 :               %If bank is 8 then..
                finish  := finish +  1
                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
                            put "Yup"
                            exit
                        label "b" :
                            points  := points -  2
                            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"
                    end case
                end loop
            label 9 :               %If bank is 9 then..
                finish  := finish +  1
                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
                            put "close"
                        label "b" :
                            points  := points -  2
                            put "Nah Bee!!"
                        label "c" :
                            points  := points -  2
                            put "No"
                        label "d" :
                            points  := points +  5
                            put "Yes, You are right"
                            exit
                        label :
                            put "Please choose the choices from above"
                    end case
                end loop
            label 10 :              %If bank is 10 then..
                finish  := finish +  1
                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
                            put "No"
                        label "b" :
                            points  := points -  2
                            put "Ha! Tricked You"
                        label "c" :
                            points  := points -  2
                            put "NO!"
                        label "d" :
                            points  := points +  5
                            put "Yes!"
                            exit
                        label :
                            put "Please choose the choices from above"
                    end case
                end loop
        end case
        exit when finish  = number_q          %When finish = to how many questions the user wants then the program will end
    end for
    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 gets
        put "Here, you win a doller"
    elsif points >  5 and points <=  10 then
        put "You won a Crappy Soccer Ball"
    elsif points >  10 and points <=  20 then
        put "You won a 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 Soccer Watch!"
    elsif points >  40 and points <=  45 then
        put "You won a Car!"
    elsif points >  45 and points <=  50 then
        put "You won an Official FIFA Soccer Ball, Soccer Jersey, Soccer Watch 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
  | 	  
 
 
Wanna Help me?
 
 
Mod Edit: Remember to use syntax tags!   	  | code: | 	 		  [syntax="Turing"]Code Here[/syntax]  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		TheFerret
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 8:41 am    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				You would have to find a way to have it so when a number is called, it it marked off a list and won't be called again. this can be done using arrays and if structures...
 
 
Code tags are your friend... 
 
 
To make some thing like this a lot more easier to follow and read, you could have the part where it says if it is correct or not in its own method so that you only have to call it from on line in each question instead of having a lot of lines being copied and pasted... | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 8:55 am    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| When I did this, I made my 'question' a procedure with parameters for the question, the answers, and the correct answer. So you need a list of questions and answers. A record would be excellent for this (though it may be a bit advanced for you). When I have to do something like this, I usually add a boolean variable set to false, and when a question is used, I set it to true. Or you could treat it like a deck of cards and 'shuffle' it. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		DanielG
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 10:15 am    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				your problem is here : bank := Rand.Int (1, 10) 
 
you keep on calling it. you could instead use Rand.Int (1,10) at the top, and then increase the counter by one after each question (take it mod 10 first) the questions would then be in the same order every time, but always start at a different point. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		uknowhoiam
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 11:41 am    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				When i asked my teacher about this problem, she said you can use an array or there is an other way too.... I already knew that i had to use an array, but i dont know how to use them, i read the tutorial but i still dont understand... plus my teacher didnt help me out, she said find a way out and you will get a bonus.....    -.- what kind of a teacher does that?
 
 
Can someone help me out with array? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Clayton
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Nov 29, 2008 7:17 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Keep things DRY. Don't Repeat Yourself. There's way too much copy and paste going on here. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Insectoid
 
  
 
    
		 | 
		
		
			
				  Posted: Sun Nov 30, 2008 12:59 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| A teacher who wants you to learn concepts on your own, as you will have to do in the 'real world'. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		qzk5j0
 
 
 
    
		 | 
		
		
			
				  Posted: Sun Nov 30, 2008 10:19 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Try adding code such as the following (you may have to tweak it for your circumstance) to pick the random number to use. It will keep looping to generate a random number until it finds a random number that it hasn't already generated:
 
 
CODE:
 
	  | Turing: | 	 		  
 
const maxnum := 5   %if you had 5 questions
 
 
%the following array will keep track if question
 
%has been asked already or not. Note that 
 
%this doesn't have to be an array of string, it
 
%could be an array of boolean, then just keep
 
%the values as 1's and 0's (True/False)
 
 
var quest: array 1 .. maxnum of string
 
 
%the following variable will hold the random
 
%number generated, making sure it hasn't
 
%been generated before
 
 
var randnum : int := 0
 
 
for i : 1 .. maxnum
 
    loop
 
        randnum := Rand.Int (1, maxnum)
 
        exit when quest (randnum) not= "Done"
 
    end loop
 
quest (randnum) := "Done"
 
  | 	  
 
 
I haven't posted in this forum before, hopefully I haven't broken any rules in how I have posted this, but I wanted to help.
 
 
Mod Edit: Please use syntax tags 	  | code: | 	 		  [syntax="Turing"]Code Here[/syntax]  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		S_Grimm
 
  
 
    
		 | 
		
		
			
				  Posted: Mon Dec 01, 2008 11:38 am    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				1) Procedures
 
2) Boolean Variables
 
3) If Statements
 
 
	  | Turing: | 	 		  
var Q1Answered,Q2Answered,Q3Answered,Q4Answered  : boolean := false
procedure Q1
 put "Question1"
Q1Answered  := true
end Q1
 procedure Q2
 put "Question 2"
Q2Answered  := true
end Q2
 procedure Q3
 put "Question 3"
Q3Answered  := true
end Q3
 procedure Q4
 put "Question 4"
Q4Answered  := true
end Q4
 var a  : int
loop
randint (a, 1, 4)
if a  = 1 and Q1Answered  = false then
Q1
 end if
if a  = 2 and Q2Answered  = false then
Q2
 end if
if a  = 3 and Q3Answered  = false then
Q3
 end if
if a  = 4 and Q4Answered  = false then
Q4
 end if
exit when ((Q4Answered  = true) and (Q3Answered  = true) and (Q2Answered  = true) and (Q1Answered  = true))
end loop
  | 	  
 
 
 
You will notice that it never repeats itself. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		uknowhoiam
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Dec 02, 2008 9:29 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Omg ty so much.... I got it to work : )
 
 
Tyvm AV
 
 
Wish i could give karma, but i only posted 3 posts  
 
 
when i do get the chance, i will +karma everyone who tried to help me,
 
 
especially AV | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		uknowhoiam
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Dec 02, 2008 9:32 pm    Post subject: Re: Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				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]  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		andrew.
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Dec 02, 2008 9:41 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Please use code tags. All you have to do is:
 
	  | code: | 	 		  [syntax="Turing"]Your code goes here[/syntax]  | 	  
 
 
Procedure is not a shuffle. Procedures are basically a list of commands to do when you call the procedure. For example, I have a procedure called do_something and inside of that is puts "Hello". By itself the procedure does nothing unless I call it by using do_something as a command. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		uknowhoiam
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Dec 03, 2008 4:53 pm    Post subject: RE:Need Help with my random questions  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				oh   thx for telling me that
 
 
we haven't done procedure in school yet,but now i know what it is   | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |