----------------------------------- Angel Wed Jan 07, 2004 12:48 am Loops ----------------------------------- I have a bug in my program and don't know how to fix it. This is it: What's supposed to happen is that when the user makes a selection between quizes 1 and 2, and they type in a wrong number, the program continues to ask the user to re-enter the number until they enter 1 or 2. But when they do enter it, nothing happens. It doesn't go to quiz 1 when they enter 1 and it doesn't clear when they enter 2. Do you know how I can fix that and make sure that it does that stuff when the user finally enters the correct number? If you do, can you please make the necessary changes in the program and post it? Thanks. ----------------------------------- shorthair Wed Jan 07, 2004 11:22 am ----------------------------------- elsif choice = 2 then cls elsif choice >= 2 then put "This is not a choice." put "Please select another choice: " .. loop get choice exit when choice = 1 or choice = 2 put "Please select another choice: " .. if choice = 1 then cls end if end loop LOOK AT THAT ELSIF STATMENT. your code is completly bassakwards, . if htey enter 1 then its gonna have a true statement ,meaning that it will exit the loop NOT HTE IF STATEMENT, you cant exit an if statement with the exit command you need somthing to be true , so not only by entering one does it get out of hte if statement it also gets out of your loop, so hte program finishes , what you need is to add another loop from the first line to the last line so that it will loop back to the tp of the program again. ----------------------------------- shorthair Wed Jan 07, 2004 11:27 am ----------------------------------- FULLY WORKING VERSION OF YOUR PROGRAM ***I edited out this old version of the code so that the forum dosent look messey and huge*** ----------------------------------- Angel Wed Jan 07, 2004 11:39 am ----------------------------------- Thanks! But no offence... you dun gotta be rude about it! I'm merely a newbe trying to make it in this huge and complicated world of Turing! :wink: ----------------------------------- shorthair Wed Jan 07, 2004 11:41 am ----------------------------------- sorry , but to me it just loked so obvious , im judging it from experiance , sorry about hte comment , :D no hard feelings , but im glad i could help fix your bug ----------------------------------- Angel Wed Jan 07, 2004 12:39 pm ----------------------------------- Thanks, and no hard feelings :) ----------------------------------- Angel Wed Jan 07, 2004 12:41 pm ----------------------------------- I've run into another problem. I tried the program you posted and it works, but when I editted it a bit (I added questions for the second quiz), it shows me an error that says: Extra 'end' So when I delete the end loop the program works again, but it's like the problem I was having before: nothing happens when the user puts in the correct number. I'll paste the program again and please see if you can modify it again to display the correct result. Thanks. ::think:: ----------------------------------- shorthair Wed Jan 07, 2004 12:51 pm ----------------------------------- Let me have this one guys , il have it up in 1 hour okay , thanks ----------------------------------- Angel Wed Jan 07, 2004 12:52 pm ----------------------------------- A whole hour?! But I can wait... as long as I can finally get it to work! :) ----------------------------------- Angel Wed Jan 07, 2004 2:03 pm ----------------------------------- Almost done? ----------------------------------- shorthair Wed Jan 07, 2004 2:09 pm ----------------------------------- here ya go :D ----------------------------------- shorthair Wed Jan 07, 2004 2:10 pm ----------------------------------- fully done , changes the entire method you did it, please ask questions so that you really understand this , dont just say you know it if you dont ----------------------------------- shorthair Wed Jan 07, 2004 2:12 pm ----------------------------------- I only actually needed literally 3 minutes , but i had to go out , i changed aabout 20 lines of code , and made procedures out of the quizes , sorry about the delay ----------------------------------- Angel Wed Jan 07, 2004 2:13 pm ----------------------------------- :cry: I hate to keep bugging you, but my computer has some stupid firewall on it and I can't download the thing. Can you please just paste the code? SOOO SORRY! :( ----------------------------------- shorthair Wed Jan 07, 2004 2:14 pm ----------------------------------- Did you get the source yet -----> its on hte next page ----------------------------------- shorthair Wed Jan 07, 2004 2:14 pm ----------------------------------- OKAY COMPSCI TIMED OUT AND SAID IT DIDNT POST BUT THE SAME CODE GOT POSTER 2 TIMES , JUST EDITING IT OUT ----------------------------------- shorthair Wed Jan 07, 2004 2:15 pm ----------------------------------- iS THERE ANY WAY TO DELETE REPLYS , BECASUE THERE ARE ALOT THAT COULD BE REMOVED FROM THIS FORUM TOPIC ----------------------------------- shorthair Wed Jan 07, 2004 2:15 pm ----------------------------------- no problem ----------------------------------- shorthair Wed Jan 07, 2004 2:16 pm ----------------------------------- its to much , edit your last messages and take the code out so this forum isnt so big , DO IT FAST ----------------------------------- Angel Wed Jan 07, 2004 2:29 pm ----------------------------------- It worked! You're amazing! Thank you so much! Now all I have left to do is make a table of scores and I should be finished! OMG! I can't thank you enough! THANK YOU SOOOO MCUH!!! Without you, I would have failed this ISP! :D:D:D:D:D:D:D!!! ----------------------------------- shorthair Wed Jan 07, 2004 2:33 pm ----------------------------------- Please edit out your last posts so that all that source is gone apart from the one i posted, no problem , were here to help eacho other , but thank you for apreciating my help ..... do you fully understand the code? ----------------------------------- shorthair Wed Jan 07, 2004 2:36 pm ----------------------------------- Who gave you those 100 bits angel , they just appeared outta nowhere ----------------------------------- Angel Wed Jan 07, 2004 3:49 pm ----------------------------------- Yeah that tends to happen a lot. I get bits from nowhere. I'm not sure how that works. Umm.. I do fully understand the program though! :D Sorry I didn't post earlier. There was something wrong with my computer! Ugh! Hate it when that happens. There's just one bug: when one of the quizes is completed, it reruns all over again. Do you know how I can possibly fix that? Ok... if I don't reply soon, there's something wrong with the computer again... :? Everything except the text appears on the screen so I dunno... But please try to fix the bug! So glad you can help and it's really appreciated! Thanks. :D ----------------------------------- shorthair Wed Jan 07, 2004 4:40 pm ----------------------------------- LATEST VERSION :D OMG IVE WRITTEN THIS THING ABOUT 9 TIMES ----------------------------------- Angel Wed Jan 07, 2004 5:00 pm ----------------------------------- Your program works alone, but when combined with mine, it doesn't. It's because I'm not sure where to put the loop. Here's a piece of my exact program: locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" delay (800) var choice : int var quizanswer, quizanswer2 : string put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 put "Would you like to do another quiz? (y/n): " .. get quizanswer if quizanswer = "n" or quizanswer = "N" then exit end if elsif choice = 2 then quiz2 put "Would you like to do another quiz? (y/n): " .. get quizanswer2 if quizanswer2 = "n" or quizanswer2 = "n" then exit end if else Draw.Text ("This is not a choice.", 1, 185, font, 13) locate (17, 1) loop put "Please select another choice: " .. get choice exit when choice = 1 or choice = 2 end loop end if end loop ----------------------------------- shorthair Wed Jan 07, 2004 5:02 pm ----------------------------------- i already made exit statments you dont need those ----------------------------------- Angel Wed Jan 07, 2004 5:04 pm ----------------------------------- Those are the exit statement you made. I took out the loop though because when I entered the number of teh quiz, it looped again, and then it finally went to the quiz. ----------------------------------- shorthair Wed Jan 07, 2004 5:05 pm ----------------------------------- i need the font variable ----------------------------------- Angel Wed Jan 07, 2004 5:07 pm ----------------------------------- var font := Font.New ("courier:10") var font3 := Font.New ("haettenschweiler:16") var name : string var phrase := "Hello and welcome to Marta and Nik's interactive MOVIE QUIZ!" var x2 := (maxx - Font.Width (phrase, font3)) div 2 var y2 := (maxy - 50) for rep2 : 1 .. length (phrase) delay (95) Font.Draw (phrase (rep2), x2, y2, font3, 13) x2 += (Font.Width (phrase (rep2), font3)) end for locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" and you know the rest of the code ----------------------------------- shorthair Wed Jan 07, 2004 5:11 pm ----------------------------------- okay now its all done using your code and your fonts and everything just change the font to what you want , this is fully done var qzns,qzns1 : string proc quiz1 cls locate (2, 16) put "A C T O R S & A C T R E S S E S" put skip delay (1000) var count : int var questions1 : array 1 .. 10 of int for m : 1 .. 10 end for count := 0 put "Question 1:" put "" put "Which of the following actors/actresses is completely blind in their left eye " put "after undergoing an operation to correct a squint? (Please enter the letter of " put "your selection)" put "" put "1) Bruce Willis" put "2) Christina Ricci" put "3) Demi Moore" put "4) Jason Biggs" put "5) Sean Connery" put "" put "Please enter the number of your selection: " .. get questions1 (1) if questions1 (1) > 5 or questions1 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop % Will rerun the program when the user does not choose one of the choices get questions1 (1) exit when questions1 (1) = 1 or questions1 (1) = 2 or questions1 (1) = 3 or questions1 (1) = 4 or questions1 (1) = 5 put "Please select another choice: " .. end loop end if if questions1 (1) = 3 then count := 0 count := count + 1 else count += 0 end if put skip put "Question 2:" put "" put "Who was the famous director of films such as E.T., Indiana Jones and Jurassic " put "Park?" put "" put "1) Peter Jackson" put "2) Michael Jackson" put "3) Steven Spielberg" put "" put "Please enter the number of your selection: " .. get questions1 (2) if questions1 (2) > 3 or questions1 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (2) exit when questions1 (2) = 1 or questions1 (2) = 2 or questions1 (2) = 3 put "Please select another choice: " .. end loop end if if questions1 (2) = 3 then count += 1 else count += 0 end if put skip put "Question 3:" put "" put "The richest actress today, who has starred in movies such as Runaway Bride, " put "Stepmom and Mona Lisa Smile is:" put "" put "1) Julia Styles" put "2) Julia Roberts" put "3) Demi Moore" put "" put "Please enter the number of your selection: " .. get questions1 (3) if questions1 (3) > 3 or questions1 (3) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (3) exit when questions1 (3) = 1 or questions1 (2) = 2 or questions1 (2) = 3 put "Please select another choice: " .. end loop end if if questions1 (3) = 2 then count += 1 else count += 0 end if put skip put "Question 4:" put "" put "Which famous body builder who became a Hollywood sensation, starred in the " put "Terminator Trilogy?" put "" put "1) Arnold Schwartzenegger" put "2) The Rock" put "3) McBain" put "" put "Please enter the number of your selection: " .. get questions1 (4) if questions1 (4) > 3 or questions1 (4) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (4) exit when questions1 (3) = 1 or questions1 (3) = 2 or questions1 (3) = 3 put "Please select another choice: " .. end loop end if if questions1 (4) = 1 then count += 1 else count += 0 end if put skip put "Question 5:" put "" put "Who was the actress who played Lara Croft in the movies, Tomb Raider I and II?" put "" put "1) Jennifer Lopez" put "2) Lara Croft" put "3) Angelina Jolie" put "" put "Please enter the number of your selection: " .. get questions1 (5) if questions1 (5) > 3 or questions1 (5) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (5) exit when questions1 (5) = 1 or questions1 (5) = 2 or questions1 (5) = 3 put "Please select another choice: " .. end loop end if if questions1 (5) = 3 then count += 1 else count += 0 end if put skip put "Question 6:" put "" put "Which actor/actress from the Lord of the Rings Trilogy stepped on a piece of " put "glass and was taken to the hospital while shooting a scene?" put "" put "1) Liv Tyler" put "2) Elija Wood" put "3) Sir Ian McKellen" put "4) Sean Austin" put "5) Miranda Otto" put "" put "Please enter the number of your selection: " .. get questions1 (6) if questions1 (6) > 5 or questions1 (6) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (6) exit when questions1 (6) = 1 or questions1 (6) = 2 or questions1 (6) = 3 or questions1 (6) = 4 or questions1 (6) = 5 put "Please select another choice: " .. end loop end if if questions1 (6) = 4 then count += 1 else count += 0 end if put skip put "Question 7:" put "" put "Which actress started her movie career by starring in the 1984 film, " put "Firestarter?" put "" put "1) Jennifer Aniston" put "2) Drew Barrymore" put "3) Kirsten Dunst" put "" put "Please enter the number of your selection: " .. get questions1 (7) if questions1 (7) > 3 or questions1 (7) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (7) exit when questions1 (7) = 1 or questions1 (7) = 2 or questions1 (7) = 3 put "Please select another choice: " .. end loop end if if questions1 (7) = 2 then count += 1 else count += 0 end if put skip put "Question 8:" put "" put "Which actress was denied 2 roles opposite Leonardo DiCaprio as Juliet in Romeo " put "and Juliet and Rose in Titanic?" put "" put "1) Courtney Cox" put "2) Christina Ricci" put "3) Uma Thurman" put "" put "Please enter the number of your selection: " .. get questions1 (8) if questions1 (8) > 3 or questions1 (8) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (8) exit when questions1 (8) = 1 or questions1 (8) = 2 or questions1 (8) = 3 put "Please select another choice: " .. end loop end if if questions1 (8) = 2 then count += 1 else count += 0 end if put skip put "Question 9:" put "" put "Which of these trios starred in the 2001 movie, Charlie's Angels?" put "" put "1) Lucy Lui, Drew Barrymore, Carmen Electra" put "2) Cameron Diaz, Lucy Lawless, Drew Barrymore" put "3) Drew Barrymore, Lucy Lui, Cameron Diaz" put "" put "Please enter the number of your selection: " .. get questions1 (9) if questions1 (9) > 3 or questions1 (9) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (9) exit when questions1 (9) = 1 or questions1 (9) = 2 or questions1 (9) = 3 put "Please select another choice: " .. end loop end if if questions1 (9) = 3 then count += 1 else count += 0 end if put skip put "Question 10:" put "" put "Mila Kunis, the star of the hit TV show, That 70's Show and the star of " put "American Psycho 2 was born in:" put "" put "1) Portugal" put "2) Ukraine" put "3) Austria" put "" put "Please enter the number of your selection: " .. get questions1 (10) if questions1 (10) > 3 or questions1 (10) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (10) exit when questions1 (10) = 1 or questions1 (10) = 2 or questions1 (10) = 3 put "Please select another choice: " .. end loop end if if questions1 (10) = 2 then count += 1 else count += 0 end if delay (1500) cls put "Your total score is ", count, " out of 10." put " type (n) to exit, anything else to try another quiz :".. get qzns cls end quiz1 %============================================================================= %============================================================================= %============================================================================= proc quiz2 cls locate (2, 23) put "M O V I E T I T L E S" put skip delay (1000) var count2 : int var questions2 : array 1 .. 10 of int for n : 1 .. 10 end for count2 := 0 put "Question 1:" put "" put "In which movie of the Indiana Jones series did Harrison Ford find the Case of" put "the 10 Commandments? (Please enter the letter of your selection)" put "" put "1) Raiders of the Lost Arc" put "2) Temple of Doom" put "3) The Last Crusade" put "" put "Please enter the number of your selection: " .. get questions2 (1) if questions2 (1) > 3 or questions2 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop % Will rerun the program when the user does not choose one of the choices get questions2 (1) exit when questions2 (1) = 1 or questions2 (1) = 2 or questions2 (1) = 3 put "Please select another choice: " .. end loop end if if questions2 (1) = 1 then count2 := 0 count2 := count2 + 1 else count2 += 0 end if put skip put "Question 2:" put "" put "In which movie does the character John Maclane (Bruce Willis), save the" put "Nakatomi Tower from terrorists?" put "" put "1) The Nakatomi Attack" put "2) Die Hard I" put "3) Die Hard II" put "" put "Please enter the number of your selection: " .. get questions2 (2) if questions2 (2) > 3 or questions2 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (2) exit when questions2 (2) = 1 or questions2 (2) = 2 or questions2 (2) = 3 put "Please select another choice: " .. end loop end if if questions2 (2) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 3:" put "" put "In which movie did Jim Carrey play a character who did wild and whacky things at" put "night, but woke up every morning with no knowledge if the previous night's" put "actions?" put "" put "1) Me, Myself and Irene" put "2) Bruce Almighty" put "3) The Mask" put "" put "Please enter the number of your selection: " .. get questions2 (3) if questions2 (3) > 3 or questions2 (3) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (3) exit when questions2 (3) = 1 or questions2 (2) = 2 or questions2 (2) = 3 put "Please select another choice: " .. end loop end if if questions2 (3) = 3 then count2 += 1 else count2 += 0 end if put skip put "Question 4:" put "" put "The following quote, said by Vin Diesel, is from which of the following movies: 'Oh the things I'm gonna do for my country...'" put "" put "1) Triple X" put "2) The Fast and the Furious" put "3) 2 Fast 2 Furious" put "" put "Please enter the number of your selection: " .. get questions2 (4) if questions2 (4) > 3 or questions2 (4) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (4) exit when questions2 (4) = 1 or questions2 (4) = 2 or questions2 (4) = 3 put "Please select another choice: " .. end loop end if if questions2 (4) = 1 then count2 += 1 else count2 += 0 end if put skip put "Question 5:" put "" put "Which 3 movies out of the following list are currently nominated for Best" put "Picture Award?" put "" put "1) The Cat in The Hat, Honey, The Lord of the Rings: The Return of the King" put "2) Cold Mountain, The Lord of the Rings: The Return of the King, Big Fish " put "3) The Texas Chainsaw Massacre, Mona Lisa Smile, Paycheck " put "" put "Please enter the number of your selection: " .. get questions2 (5) if questions2 (5) > 3 or questions2 (5) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (5) exit when questions2 (5) = 1 or questions2 (5) = 2 or questions2 (5) = 3 put "Please select another choice: " .. end loop end if if questions2 (5) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 6:" put "" put "In which of the following movies did people really attempt to fly?" put "" put "1) Tomb Raider II" put "2) Peter Pan" put "3) Paycheck" put "" put "Please enter the number of your selection: " .. get questions2 (6) if questions2 (6) > 3 or questions2 (6) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (6) exit when questions2 (6) = 1 or questions2 (6) = 2 or questions2 (6) = 3 put "Please select another choice: " .. end loop end if if questions2 (6) = 1 then count2 += 1 else count2 += 0 end if put skip put "Question 7:" put "" put "The quote, 'Life is like a box of chocolates, you never know which one your" put "going to get,' is from which of the following movies?" put "" put "1) Jumanji" put "2) Forest Gump" put "3) Cast Away" put "" put "Please enter the number of your selection: " .. get questions2 (7) if questions2 (7) > 3 or questions2 (7) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (7) exit when questions2 (7) = 1 or questions2 (7) = 2 or questions2 (7) = 3 put "Please select another choice: " .. end loop end if if questions2 (7) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 8:" put "" put "Which of the following movies allowed a child actor to play the main character" put "for the first time in history?" put "" put "1) The Cat in the Hat" put "2) The Home Alone series" put "3) Peter Pan" put "" put "Please enter the number of your selection: " .. get questions2 (8) if questions2 (8) > 3 or questions2 (8) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (8) exit when questions2 (8) = 1 or questions2 (8) = 2 or questions2 (8) = 3 put "Please select another choice: " .. end loop end if if questions2 (8) = 3 then count2 += 1 else count2 += 0 end if put skip put "Question 9:" put "" put "Which of the following 3 movies required a real life actor to play the part of" put "an animated character?" put "" put "1) Shrek" put "2) The Lord of the Rings Trilogy" put "3) Finding Nemo" put "" put "Please enter the number of your selection: " .. get questions2 (9) if questions2 (9) > 3 or questions2 (9) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (9) exit when questions2 (9) = 1 or questions2 (9) = 2 or questions2 (9) = 3 put "Please select another choice: " .. end loop end if if questions2 (9) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 10:" put "" put "In what movie did actors, Dan Aykroyd, Bill Murray, Sigourney Weaver and Harold Ramis go on a journey to hunt for ghosts?" put "" put "1) Ghost Ship" put "2) Ghostbusters" put "3) Casper the Friendly Ghost" put "" put "Please enter the number of your selection: " .. get questions2 (10) if questions2 (10) > 3 or questions2 (10) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (10) exit when questions2 (10) = 1 or questions2 (10) = 2 or questions2 (10) = 3 put "Please select another choice: " .. end loop end if if questions2 (10) = 2 then count2 += 1 else count2 += 0 end if delay (1500) cls put "Your total score is ", count2, " out of 10." put " type (n) to exit, anything else to try another quiz :".. get qzns1 cls end quiz2 %============================================================================= %============================================================================= %==========================================MAIN=============================== var name:string(20) var font : int font := Font.New ("serif:12") locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" delay (800) var choice : int loop cls put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 if qzns = "n" or qzns = "N" then exit end if elsif choice = 2 then quiz2 if qzns1 = "n" or qzns1 = "N" then exit end if else cls put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 if qzns = "n" or qzns = "N" then exit end if elsif choice = 2 then quiz2 if qzns1 = "n" or qzns1 = "N" then exit end if end if cls end if end loop ----------------------------------- Angel Wed Jan 07, 2004 5:12 pm ----------------------------------- The problem is that when you type in a few wrong answers and then the right one, it goes again... :? ----------------------------------- shorthair Wed Jan 07, 2004 5:13 pm ----------------------------------- dude ive rewritten your program like 9 times , i definatly want hte bits after this one, now tell me what this new problem is ----------------------------------- Angel Wed Jan 07, 2004 5:16 pm ----------------------------------- Like I said, I'll give you ALL my bits I promise... ok, I posted the font codes on the second page. Now, when the user types in the wrong choice, and then they type in the right one, the program reruns... it asks them to type in a choice again. Here's the code that's giving me trouble: var font := Font.New ("courier:10") var font3 := Font.New ("haettenschweiler:16") var name : string var phrase := "Hello and welcome to Marta and Nik's interactive MOVIE QUIZ!" var x2 := (maxx - Font.Width (phrase, font3)) div 2 var y2 := (maxy - 50) for rep2 : 1 .. length (phrase) delay (95) Font.Draw (phrase (rep2), x2, y2, font3, 13) x2 += (Font.Width (phrase (rep2), font3)) end for locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" delay (800) loop var choice : int var quizanswer, quizanswer2 : string put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 put "Would you like to do another quiz? (y/n): " .. get quizanswer if quizanswer = "n" or quizanswer = "N" then exit end if elsif choice = 2 then quiz2 put "Would you like to do another quiz? (y/n): " .. get quizanswer2 if quizanswer2 = "n" or quizanswer2 = "n" then exit end if else Draw.Text ("This is not a choice.", 1, 185, font, 13) locate (17, 1) loop put "Please select another choice: " .. get choice exit when choice = 1 or choice = 2 end loop end if end loop ----------------------------------- shorthair Wed Jan 07, 2004 5:18 pm ----------------------------------- HERE IS HTE FULL PROGRAM WORKING WITH YOUR VARIABLE JUST CHANGE THE FONT SETTINGS AND HTE FIRST LOCATE var qzns,qzns1 : string proc quiz1 cls locate (2, 16) put " A C T O R S & A C T R E S S E S" put skip delay (1000) var count : int var questions1 : array 1 .. 10 of int for m : 1 .. 10 end for count := 0 put "Question 1:" put "" put "Which of the following actors/actresses is completely blind in their left eye " put "after undergoing an operation to correct a squint? (Please enter the letter of " put "your selection)" put "" put "1) Bruce Willis" put "2) Christina Ricci" put "3) Demi Moore" put "4) Jason Biggs" put "5) Sean Connery" put "" put "Please enter the number of your selection: " .. get questions1 (1) if questions1 (1) > 5 or questions1 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop % Will rerun the program when the user does not choose one of the choices get questions1 (1) exit when questions1 (1) = 1 or questions1 (1) = 2 or questions1 (1) = 3 or questions1 (1) = 4 or questions1 (1) = 5 put "Please select another choice: " .. end loop end if if questions1 (1) = 3 then count := 0 count := count + 1 else count += 0 end if put skip put "Question 2:" put "" put "Who was the famous director of films such as E.T., Indiana Jones and Jurassic " put "Park?" put "" put "1) Peter Jackson" put "2) Michael Jackson" put "3) Steven Spielberg" put "" put "Please enter the number of your selection: " .. get questions1 (2) if questions1 (2) > 3 or questions1 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (2) exit when questions1 (2) = 1 or questions1 (2) = 2 or questions1 (2) = 3 put "Please select another choice: " .. end loop end if if questions1 (2) = 3 then count += 1 else count += 0 end if put skip put "Question 3:" put "" put "The richest actress today, who has starred in movies such as Runaway Bride, " put "Stepmom and Mona Lisa Smile is:" put "" put "1) Julia Styles" put "2) Julia Roberts" put "3) Demi Moore" put "" put "Please enter the number of your selection: " .. get questions1 (3) if questions1 (3) > 3 or questions1 (3) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (3) exit when questions1 (3) = 1 or questions1 (2) = 2 or questions1 (2) = 3 put "Please select another choice: " .. end loop end if if questions1 (3) = 2 then count += 1 else count += 0 end if put skip put "Question 4:" put "" put "Which famous body builder who became a Hollywood sensation, starred in the " put "Terminator Trilogy?" put "" put "1) Arnold Schwartzenegger" put "2) The Rock" put "3) McBain" put "" put "Please enter the number of your selection: " .. get questions1 (4) if questions1 (4) > 3 or questions1 (4) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (4) exit when questions1 (4) = 1 or questions1 (4) = 2 or questions1 (4) = 3 put "Please select another choice: " .. end loop end if if questions1 (4) = 1 then count += 1 else count += 0 end if put skip put "Question 5:" put "" put "Who was the actress who played Lara Croft in the movies, Tomb Raider I and II?" put "" put "1) Jennifer Lopez" put "2) Lara Croft" put "3) Angelina Jolie" put "" put "Please enter the number of your selection: " .. get questions1 (5) if questions1 (5) > 3 or questions1 (5) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (5) exit when questions1 (5) = 1 or questions1 (5) = 2 or questions1 (5) = 3 put "Please select another choice: " .. end loop end if if questions1 (5) = 3 then count += 1 else count += 0 end if put skip put "Question 6:" put "" put "Which actor/actress from the Lord of the Rings Trilogy stepped on a piece of " put "glass and was taken to the hospital while shooting a scene?" put "" put "1) Liv Tyler" put "2) Elija Wood" put "3) Sir Ian McKellen" put "4) Sean Austin" put "5) Miranda Otto" put "" put "Please enter the number of your selection: " .. get questions1 (6) if questions1 (6) > 5 or questions1 (6) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (6) exit when questions1 (6) = 1 or questions1 (6) = 2 or questions1 (6) = 3 or questions1 (6) = 4 or questions1 (6) = 5 put "Please select another choice: " .. end loop end if if questions1 (6) = 4 then count += 1 else count += 0 end if put skip put "Question 7:" put "" put "Which actress started her movie career by starring in the 1984 film, " put "Firestarter?" put "" put "1) Jennifer Aniston" put "2) Drew Barrymore" put "3) Kirsten Dunst" put "" put "Please enter the number of your selection: " .. get questions1 (7) if questions1 (7) > 3 or questions1 (7) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (7) exit when questions1 (7) = 1 or questions1 (7) = 2 or questions1 (7) = 3 put "Please select another choice: " .. end loop end if if questions1 (7) = 2 then count += 1 else count += 0 end if put skip put "Question 8:" put "" put "Which actress was denied 2 roles opposite Leonardo DiCaprio as Juliet in Romeo " put "and Juliet and Rose in Titanic?" put "" put "1) Courtney Cox" put "2) Christina Ricci" put "3) Uma Thurman" put "" put "Please enter the number of your selection: " .. get questions1 (8) if questions1 (8) > 3 or questions1 (8) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (8) exit when questions1 (8) = 1 or questions1 (8) = 2 or questions1 (8) = 3 put "Please select another choice: " .. end loop end if if questions1 (8) = 2 then count += 1 else count += 0 end if put skip put "Question 9:" put "" put "Which of these trios starred in the 2001 movie, Charlie's Angels?" put "" put "1) Lucy Lui, Drew Barrymore, Carmen Electra" put "2) Cameron Diaz, Lucy Lawless, Drew Barrymore" put "3) Drew Barrymore, Lucy Lui, Cameron Diaz" put "" put "Please enter the number of your selection: " .. get questions1 (9) if questions1 (9) > 3 or questions1 (9) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (9) exit when questions1 (9) = 1 or questions1 (9) = 2 or questions1 (9) = 3 put "Please select another choice: " .. end loop end if if questions1 (9) = 3 then count += 1 else count += 0 end if put skip put "Question 10:" put "" put "Mila Kunis, the star of the hit TV show, That 70's Show and the star of " put "American Psycho 2 was born in:" put "" put "1) Portugal" put "2) Ukraine" put "3) Austria" put "" put "Please enter the number of your selection: " .. get questions1 (10) if questions1 (10) > 3 or questions1 (10) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions1 (10) exit when questions1 (10) = 1 or questions1 (10) = 2 or questions1 (10) = 3 put "Please select another choice: " .. end loop end if if questions1 (10) = 2 then count += 1 else count += 0 end if delay (1500) cls put "Your total score is ", count, " out of 10." put " type (n) to exit, anything else to try another quiz :".. get qzns cls end quiz1 %============================================================================= %============================================================================= %============================================================================= proc quiz2 cls locate (2, 23) put "M O V I E T I T L E S" put skip delay (1000) var count2 : int var questions2 : array 1 .. 10 of int for n : 1 .. 10 end for count2 := 0 put "Question 1:" put "" put "In which movie of the Indiana Jones series did Harrison Ford find the Case of" put "the 10 Commandments? (Please enter the letter of your selection)" put "" put "1) Raiders of the Lost Arc" put "2) Temple of Doom" put "3) The Last Crusade" put "" put "Please enter the number of your selection: " .. get questions2 (1) if questions2 (1) > 3 or questions2 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop % Will rerun the program when the user does not choose one of the choices get questions2 (1) exit when questions2 (1) = 1 or questions2 (1) = 2 or questions2 (1) = 3 put "Please select another choice: " .. end loop end if if questions2 (1) = 1 then count2 := 0 count2 := count2 + 1 else count2 += 0 end if put skip put "Question 2:" put "" put "In which movie does the character John Maclane (Bruce Willis), save the" put "Nakatomi Tower from terrorists?" put "" put "1) The Nakatomi Attack" put "2) Die Hard I" put "3) Die Hard II" put "" put "Please enter the number of your selection: " .. get questions2 (2) if questions2 (2) > 3 or questions2 (1) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (2) exit when questions2 (2) = 1 or questions2 (2) = 2 or questions2 (2) = 3 put "Please select another choice: " .. end loop end if if questions2 (2) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 3:" put "" put "In which movie did Jim Carrey play a character who did wild and whacky things at" put "night, but woke up every morning with no knowledge if the previous night's" put "actions?" put "" put "1) Me, Myself and Irene" put "2) Bruce Almighty" put "3) The Mask" put "" put "Please enter the number of your selection: " .. get questions2 (3) if questions2 (3) > 3 or questions2 (3) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (3) exit when questions2 (3) = 1 or questions2 (2) = 2 or questions2 (2) = 3 put "Please select another choice: " .. end loop end if if questions2 (3) = 3 then count2 += 1 else count2 += 0 end if put skip put "Question 4:" put "" put "The following quote, said by Vin Diesel, is from which of the following movies: 'Oh the things I'm gonna do for my country...'" put "" put "1) Triple X" put "2) The Fast and the Furious" put "3) 2 Fast 2 Furious" put "" put "Please enter the number of your selection: " .. get questions2 (4) if questions2 (4) > 3 or questions2 (4) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (4) exit when questions2 (4) = 1 or questions2 (4) = 2 or questions2 (4) = 3 put "Please select another choice: " .. end loop end if if questions2 (4) = 1 then count2 += 1 else count2 += 0 end if put skip put "Question 5:" put "" put "Which 3 movies out of the following list are currently nominated for Best" put "Picture Award?" put "" put "1) The Cat in The Hat, Honey, The Lord of the Rings: The Return of the King" put "2) Cold Mountain, The Lord of the Rings: The Return of the King, Big Fish " put "3) The Texas Chainsaw Massacre, Mona Lisa Smile, Paycheck " put "" put "Please enter the number of your selection: " .. get questions2 (5) if questions2 (5) > 3 or questions2 (5) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (5) exit when questions2 (5) = 1 or questions2 (5) = 2 or questions2 (5) = 3 put "Please select another choice: " .. end loop end if if questions2 (5) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 6:" put "" put "In which of the following movies did people really attempt to fly?" put "" put "1) Tomb Raider II" put "2) Peter Pan" put "3) Paycheck" put "" put "Please enter the number of your selection: " .. get questions2 (6) if questions2 (6) > 3 or questions2 (6) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (6) exit when questions2 (6) = 1 or questions2 (6) = 2 or questions2 (6) = 3 put "Please select another choice: " .. end loop end if if questions2 (6) = 1 then count2 += 1 else count2 += 0 end if put skip put "Question 7:" put "" put "The quote, 'Life is like a box of chocolates, you never know which one your" put "going to get,' is from which of the following movies?" put "" put "1) Jumanji" put "2) Forest Gump" put "3) Cast Away" put "" put "Please enter the number of your selection: " .. get questions2 (7) if questions2 (7) > 3 or questions2 (7) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (7) exit when questions2 (7) = 1 or questions2 (7) = 2 or questions2 (7) = 3 put "Please select another choice: " .. end loop end if if questions2 (7) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 8:" put "" put "Which of the following movies allowed a child actor to play the main character" put "for the first time in history?" put "" put "1) The Cat in the Hat" put "2) The Home Alone series" put "3) Peter Pan" put "" put "Please enter the number of your selection: " .. get questions2 (8) if questions2 (8) > 3 or questions2 (8) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (8) exit when questions2 (8) = 1 or questions2 (8) = 2 or questions2 (8) = 3 put "Please select another choice: " .. end loop end if if questions2 (8) = 3 then count2 += 1 else count2 += 0 end if put skip put "Question 9:" put "" put "Which of the following 3 movies required a real life actor to play the part of" put "an animated character?" put "" put "1) Shrek" put "2) The Lord of the Rings Trilogy" put "3) Finding Nemo" put "" put "Please enter the number of your selection: " .. get questions2 (9) if questions2 (9) > 3 or questions2 (9) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (9) exit when questions2 (9) = 1 or questions2 (9) = 2 or questions2 (9) = 3 put "Please select another choice: " .. end loop end if if questions2 (9) = 2 then count2 += 1 else count2 += 0 end if put skip put "Question 10:" put "" put "In what movie did actors, Dan Aykroyd, Bill Murray, Sigourney Weaver and Harold Ramis go on a journey to hunt for ghosts?" put "" put "1) Ghost Ship" put "2) Ghostbusters" put "3) Casper the Friendly Ghost" put "" put "Please enter the number of your selection: " .. get questions2 (10) if questions2 (10) > 3 or questions2 (10) = 0 then put "This is not a choice." put "Please select another choice: " .. loop get questions2 (10) exit when questions2 (10) = 1 or questions2 (10) = 2 or questions2 (10) = 3 put "Please select another choice: " .. end loop end if if questions2 (10) = 2 then count2 += 1 else count2 += 0 end if delay (1500) cls put "Your total score is ", count2, " out of 10." put " type (n) to exit, anything else to try another quiz :".. get qzns1 cls end quiz2 %============================================================================= %============================================================================= %==========================================MAIN=============================== var name:string(20) var font : int font := Font.New ("serif:12") locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" delay (800) var choice : int loop cls put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 if qzns = "n" or qzns = "N" then exit end if elsif choice = 2 then quiz2 if qzns1 = "n" or qzns1 = "N" then exit end if else cls put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 if qzns = "n" or qzns = "N" then exit end if elsif choice = 2 then quiz2 if qzns1 = "n" or qzns1 = "N" then exit end if end if cls end if end loop ----------------------------------- shorthair Wed Jan 07, 2004 5:41 pm ----------------------------------- .... what do you mean the 2 programs dont mix ..... you cant just give me half the code ..... ive been working here for you for about 6 hours and now you bring it up , ehy didnt you give me all hte code , you cant just and new code and hope it works ----------------------------------- Angel Wed Jan 07, 2004 5:49 pm ----------------------------------- Don't worry, it's all good. I just have one question. For this part of the code: locate (6, 1) delay (700) colour (13) put "Please enter your name: " .. get name : * put "" delay (800) var choice : int var quizanswer, quizanswer2 : string loop put "GREAT! Now ", name, ", what kind of quiz would you like to do?" put "" Draw.Text ("1. Actors/Actresses", 1, 287, font, 13) Draw.Text ("2. Movie Titles", 1, 267, font, 13) put "" Draw.Text ("Please type the number of your selection. Then press : ", 1, 205, font, 13) locate (15, 65) get choice if choice = 1 then quiz1 put "Would you like to do another quiz? (y/n): " .. get quizanswer if quizanswer = "n" or quizanswer = "N" then exit end if elsif choice = 2 then quiz2 put "Would you like to do another quiz? (y/n): " .. get quizanswer2 if quizanswer2 = "n" or quizanswer2 = "n" then exit end if else Draw.Text ("This is not a choice.", 1, 185, font, 13) locate (17, 1) loop put "Please select another choice: " .. get choice exit when choice = 1 or choice = 2 end loop if choice = 0 or choice > 2 then Draw.Text ("This is not a choice.", 1, 185, font, 13) locate (17, 1) loop put "Please select another choice: " .. get choice exit when choice = 1 or choice = 2 end loop elsif choice = 1 then quiz1 put "Would you like to do another quiz? (y/n): " .. get quizanswer if quizanswer = "n" or quizanswer = "N" then exit end if elsif choice = 2 then quiz2 put "Would you like to do another quiz? (y/n): " .. get quizanswer2 if quizanswer2 = "n" or quizanswer2 = "n" then exit end if end if cls end if end loop When the user enters "y" or "Y" at the end of whichever quiz, where is the command which directs the program on what to do? ----------------------------------- shorthair Wed Jan 07, 2004 5:50 pm ----------------------------------- there isnt one , if the answer isnt no , it reruns the loop ( which is the begining of hte program) if it is = to n then it exits that main loop and ends the program WHERE ARE THE BITS ----------------------------------- shorthair Wed Jan 07, 2004 5:51 pm ----------------------------------- FINALLY WE HAVE FINISHED THIS NEVER ENDING PROGRAM ----------------------------------- Angel Wed Jan 07, 2004 5:52 pm ----------------------------------- No, THANK YOU!!! :D ----------------------------------- shorthair Wed Jan 07, 2004 5:56 pm ----------------------------------- DID YOU GET YOUR CODE TO MIX WITH THE NEW CODE , OR DO I HAVE TO DO ANY LAST MINUTE ADJSTMENTS ----------------------------------- Angel Wed Jan 07, 2004 5:59 pm ----------------------------------- I'll get it I'll get it... I hope :) It's just that teh layout is a little bit messed up. ----------------------------------- shorthair Wed Jan 07, 2004 6:04 pm ----------------------------------- okay send everything to my email address and il work out any last minute bugs for you , ive got a lazy night after hockey , so you can count on me to have it done , im only using code that you understand , this program could be about 100 lines shorther minimum but im not about to help you cheat , but becuse of your circumstances and that you ave been willing to learn , i dont mind finishing it up for you Email : ark_angel3@hotmail.com ----------------------------------- Angel Wed Jan 07, 2004 6:07 pm ----------------------------------- I LOVE YOU! You've been a great help... I'll continue trying to figure it out and I'll send you the file a bit later... Have fun at hockey! :D ----------------------------------- shorthair Wed Jan 07, 2004 6:58 pm ----------------------------------- have 15 BITS for being hot :D