Computer Science Canada

My program won't close

Author:  Angel [ Thu Jan 08, 2004 10:28 am ]
Post subject:  My program won't close

My program won't close when the user runs the quiz again and then types in "n" or "N" to exit. I want the program to cls and then put "The End" in the middle of the screen but it reruns the program again. How can I fix it?

Also, how can I center all the titles since the program is operationg on ?setscreen Here's the code:

code:
% Programmed by Nikolas Zboralski, Marta Ustyanich
% Programmed for: Mr. Calomeni
% File name: movie_trivia.t
% Date: Jan. 7, 2004
% Description: This will be a program that has questions and the user will have to choose the correct one otherwise they will get it wrong.

setscreen ("graphics")              % Enter graphics mode
setscreen ("graphics:800;500")              % Change window to 800x500
setscreen ("nocursor")

proc quiz1 % makes quiz 1 into a process
    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 answer1 : array 1 .. 10 of int % declres users answers as an array
    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 answer1 (1)
    if answer1 (1) > 5 or answer1 (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 answer1 (1)
            exit when answer1 (1) = 1 or answer1 (1) = 2 or answer1 (1) = 3 or answer1 (1) = 4 or answer1 (1) = 5
            put "Please select another choice:  " ..
        end loop
    end if


    if answer1 (1) = 3 then % if the user's answer is correct, this automatically adds 1 point for the user
        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 answer1 (2)
    if answer1 (2) > 3 or answer1 (1) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (2)
            exit when answer1 (2) = 1 or answer1 (2) = 2 or answer1 (2) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (3)
    if answer1 (3) > 3 or answer1 (3) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (3)
            exit when answer1 (3) = 1 or answer1 (2) = 2 or answer1 (2) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (4)
    if answer1 (4) > 3 or answer1 (4) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (4)
            exit when answer1 (3) = 1 or answer1 (3) = 2 or answer1 (3) = 3
            put "Please select another choice:  " ..
        end loop
    end if


    if answer1 (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 answer1 (5)
    if answer1 (5) > 3 or answer1 (5) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (5)
            exit when answer1 (5) = 1 or answer1 (5) = 2 or answer1 (5) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (6)
    if answer1 (6) > 5 or answer1 (6) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (6)
            exit when answer1 (6) = 1 or answer1 (6) = 2 or answer1 (6) = 3 or answer1 (6) = 4 or answer1 (6) = 5
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (7)
    if answer1 (7) > 3 or answer1 (7) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (7)
            exit when answer1 (7) = 1 or answer1 (7) = 2 or answer1 (7) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (8)
    if answer1 (8) > 3 or answer1 (8) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (8)
            exit when answer1 (8) = 1 or answer1 (8) = 2 or answer1 (8) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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 answer1 (9)
    if answer1 (9) > 3 or answer1 (9) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (9)
            exit when answer1 (9) = 1 or answer1 (9) = 2 or answer1 (9) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (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) Ukraine"
    put "2) Portugal"
    put "3) Austria"
    put ""
    put "Please enter the number of your selection:  " ..
    get answer1 (10)
    if answer1 (10) > 3 or answer1 (10) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer1 (10)
            exit when answer1 (10) = 1 or answer1 (10) = 2 or answer1 (10) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer1 (10) = 1 then
        count += 1
    else
        count += 0
    end if

    delay (1500)
    cls

    var font2 := Font.New ("haettenschweiler:16") % the user's scores are displayed
    var phrase2 := "- Y  O  U  R    S  C  O  R  E  S  -"
    var x3 := (maxx - Font.Width (phrase2, font2)) div 2
    var y3 := (maxy - 50)
    for rep3 : 1 .. length (phrase2)
        delay (50)
        Font.Draw (phrase2 (rep3), x3, y3, font2, 13)
        x3 += (Font.Width (phrase2 (rep3), font2))
    end for

    locate (5, 9)
    put "QUESTION NUMBER     YOUR ANSWER     CORRECT ANSWER     POINTS"
    put ""
    for count3 : 1 .. 10
        put count3 : 15
    end for

    locate (7, 34)
    put answer1 (1)
    locate (8, 34)
    put answer1 (2)
    locate (9, 34)
    put answer1 (3)
    locate (10, 34)
    put answer1 (4)
    locate (11, 34)
    put answer1 (5)
    locate (12, 34)
    put answer1 (6)
    locate (13, 34)
    put answer1 (7)
    locate (14, 34)
    put answer1 (8)
    locate (15, 34)
    put answer1 (9)
    locate (16, 34)
    put answer1 (10)

    var canswer : array 1 .. 10 of int
    locate (7, 52)
    canswer (1) := 3
    put canswer (1)
    locate (8, 52)
    canswer (2) := 3
    put canswer (2)
    locate (9, 52)
    canswer (3) := 2
    put canswer (3)
    locate (10, 52)
    canswer (4) := 1
    put canswer (4)
    locate (11, 52)
    canswer (5) := 3
    put canswer (5)
    locate (12, 52)
    canswer (6) := 4
    put canswer (6)
    locate (13, 52)
    canswer (7) := 2
    put canswer (7)
    locate (14, 52)
    canswer (8) := 2
    put canswer (8)
    locate (15, 52)
    canswer (9) := 3
    put canswer (9)
    locate (16, 52)
    canswer (10) := 1
    put canswer (10)

    for count4 : 1 .. 10 % displays the points that the user received for each answer
        locate (count4 + 6, 34)
        put answer1 (count4)
        locate (count4 + 6, 52)
        put canswer (count4)
        locate (count4 + 6, 67)
        if answer1 (count4) = canswer (count4) then
            put 1
        else
            put 0
        end if
    end for

    locate (19, 1)
    put "Your total score is ", count, " out of 10." %displays user's total points
    put ""
    if count >= 7 then
        put "You're like a star stocker!"
    elsif count >= 5 and count <= 7 then
        put "Pretty good!"
    else
        put "You need to watch more Entertainment Tonight!"
    end if
end quiz1 % the end of the process "quiz1"

proc quiz2 % makes quiz 2 into a process
    cls

    locate (2, 23)
    put "M  O  V  I  E     T  I  T  L  E  S"
    put skip
    delay (1000)

    var count2 : int
    var answer2 : 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 answer2 (1)
    if answer2 (1) > 3 or answer2 (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 answer2 (1)
            exit when answer2 (1) = 1 or answer2 (1) = 2 or answer2 (1) = 3
            put "Please select another choice:  " ..
        end loop
    end if


    if answer2 (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 answer2 (2)
    if answer2 (2) > 3 or answer2 (1) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (2)
            exit when answer2 (2) = 1 or answer2 (2) = 2 or answer2 (2) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (3)
    if answer2 (3) > 3 or answer2 (3) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (3)
            exit when answer2 (3) = 1 or answer2 (2) = 2 or answer2 (2) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (4)
    if answer2 (4) > 3 or answer2 (4) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (4)
            exit when answer2 (4) = 1 or answer2 (4) = 2 or answer2 (4) = 3
            put "Please select another choice:  " ..
        end loop
    end if


    if answer2 (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 answer2 (5)
    if answer2 (5) > 3 or answer2 (5) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (5)
            exit when answer2 (5) = 1 or answer2 (5) = 2 or answer2 (5) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (6)
    if answer2 (6) > 3 or answer2 (6) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (6)
            exit when answer2 (6) = 1 or answer2 (6) = 2 or answer2 (6) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (7)
    if answer2 (7) > 3 or answer2 (7) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (7)
            exit when answer2 (7) = 1 or answer2 (7) = 2 or answer2 (7) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (8)
    if answer2 (8) > 3 or answer2 (8) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (8)
            exit when answer2 (8) = 1 or answer2 (8) = 2 or answer2 (8) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (9)
    if answer2 (9) > 3 or answer2 (9) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (9)
            exit when answer2 (9) = 1 or answer2 (9) = 2 or answer2 (9) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (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 answer2 (10)
    if answer2 (10) > 3 or answer2 (10) = 0 then
        put "This is not a choice."
        put "Please select another choice:  " ..
        loop
            get answer2 (10)
            exit when answer2 (10) = 1 or answer2 (10) = 2 or answer2 (10) = 3
            put "Please select another choice:  " ..
        end loop
    end if

    if answer2 (10) = 2 then
        count2 += 1
    else
        count2 += 0
    end if

    delay (1500)
    cls

    var font2 := Font.New ("haettenschweiler:16") % displays user's scored
    var font4 := Font.New ("courier:10")
    var phrase2 := "- Y  O  U  R    S  C  O  R  E  S  -"
    var x3 := (maxx - Font.Width (phrase2, font2)) div 2
    var y3 := (maxy - 50)
    for rep3 : 1 .. length (phrase2)
        delay (50)
        Font.Draw (phrase2 (rep3), x3, y3, font2, 13)
        x3 += (Font.Width (phrase2 (rep3), font2))
    end for

    locate (5, 9)
    put "QUESTION NUMBER     YOUR ANSWER     CORRECT ANSWER     POINTS"
    put ""
    for count3 : 1 .. 10
        put count3 : 15
    end for
    locate (7, 34)
    put answer2 (1)
    locate (8, 34)
    put answer2 (2)
    locate (9, 34)
    put answer2 (3)
    locate (10, 34)
    put answer2 (4)
    locate (11, 34)
    put answer2 (5)
    locate (12, 34)
    put answer2 (6)
    locate (13, 34)
    put answer2 (7)
    locate (14, 34)
    put answer2 (8)
    locate (15, 34)
    put answer2 (9)
    locate (16, 34)
    put answer2 (10)

    var canswer2 : array 1 .. 10 of int
    locate (7, 52)
    canswer2 (1) := 1
    put canswer2 (1)
    locate (8, 52)
    canswer2 (2) := 2
    put canswer2 (2)
    locate (9, 52)
    canswer2 (3) := 3
    put canswer2 (3)
    locate (10, 52)
    canswer2 (4) := 1
    put canswer2 (4)
    locate (11, 52)
    canswer2 (5) := 2
    put canswer2 (5)
    locate (12, 52)
    canswer2 (6) := 1
    put canswer2 (6)
    locate (13, 52)
    canswer2 (7) := 2
    put canswer2 (7)
    locate (14, 52)
    canswer2 (8) := 3
    put canswer2 (8)
    locate (15, 52)
    canswer2 (9) := 2
    put canswer2 (9)
    locate (16, 52)
    canswer2 (10) := 2
    put canswer2 (10)

    for count3 : 1 .. 10 % displays the that the user earned for each answer
        locate (count3 + 6, 34)
        put answer2 (count3)
        locate (count3 + 6, 52)
        put canswer2 (count3)
        locate (count3 + 6, 67)
        if answer2 (count3) = canswer2 (count3) then
            put 1
        else
            put 0
        end if
    end for

    locate (19, 1)
    put "Your total score is ", count2, " out of 10." % outputs total score
    put ""
    if count2 >= 7 then
        put "You would make a GREAT movie critic!"
    elsif count2 >= 5 and count2 <= 7 then
        put "You need to brush up on your movies!"
    else
        put "There is such a thing called BLOCKBUSTER!!!"
    end if


end quiz2 % ends the process "quiz2"

delay (3000)
cls

var font := Font.New ("courier:10")
var font3 := Font.New ("haettenschweiler:16")
var name : string

var phrase := "Hello and welcome to Nik and Marta'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)
var choice : int
var quizanswer, quizanswer2 : string % the user has the chance to select between continuing runnnig the program or exiting
var font5 := Font.New ("georgia:36")
var phrase5 := "The End"
var x5 := (maxx - Font.Width (phrase5, font5)) div 2
var y5 := (maxy - 200)

proc loopquiz % this process allows the user to continue running the program
    loop
        put ""
        put "GREAT! Now ", name, ", what kind of quiz would you like to do?"
        put ""
        put "1. Actors/Actresses"
        put "2. Movie Titles"
        put ""
        put "Please type the number of your selection. Then press <<ENTER>>:  " ..
        get choice

        if choice = 1 then
            quiz1
            put ""
            put "Would you like to do another quiz? (y/n):  " ..
            get quizanswer
            if quizanswer = "n" or quizanswer = "N" then
                cls
                exit
            elsif quizanswer = "y" or quizanswer = "Y" then
                loopquiz
            else
                put "This is not a choice."
                loop
                    put "Please select another choice:  " ..
                    get quizanswer
                    exit when quizanswer = "y" or quizanswer = "Y" or quizanswer = "n" or quizanswer = "N"
                end loop
            end if

        elsif choice = 2 then
            quiz2
            put ""
            put "Would you like to do another quiz? (y/n):  " ..
            get quizanswer2
            if quizanswer2 = "n" or quizanswer2 = "n" then
                cls

                exit
            elsif quizanswer2 = "y" or quizanswer2 = "Y" then
                loopquiz
            else
                put "This is not a choice."
                loop
                    put "Please select another choice:  " ..
                    get quizanswer2
                    exit when quizanswer2 = "y" or quizanswer2 = "Y" or quizanswer2 = "n" or quizanswer2 = "N"
                end loop
            end if

        else
            put "This is not a choice."
            loop
                put "Please select another choice:  " ..
                get choice
                exit when choice = 1 or choice = 2
            end loop
        end if

    end loop
end loopquiz         % end of process

locate (8, 1)
loop
    put ""
    put "GREAT! Now ", name, ", what kind of quiz would you like to do?"         % allows the user to select between quizzes
    put ""
    put "1. Actors/Actresses"
    put "2. Movie Titles"
    put ""
    put "Please type the number of your selection. Then press <<ENTER>>:  " ..
    get choice

    if choice = 1 then
        quiz1
        put ""
        put "Would you like to do another quiz? (y/n):  " ..
        get quizanswer
        if quizanswer = "n" or quizanswer = "N" then
            cls
                for rep5 : 1 .. length (phrase5)
                delay (95)
                Font.Draw (phrase5 (rep5), x5, y5, font5, white)
                x5 += (Font.Width (phrase5 (rep5), font5))
            end for
            exit

        elsif quizanswer = "y" or quizanswer = "Y" then
            loopquiz
        else
            put "This is not a choice."
            loop
                put "Please select another choice:  " ..
                get quizanswer
                exit when quizanswer = "y" or quizanswer = "Y" or quizanswer = "n" or quizanswer = "N"
            end loop
        end if

    elsif choice = 2 then
        quiz2
        put ""
        put "Would you like to do another quiz? (y/n):  " ..
        get quizanswer2
        if quizanswer2 = "n" or quizanswer2 = "N" then
            cls
            for rep5 : 1 .. length (phrase5)
                delay (95)
                Font.Draw (phrase5 (rep5), x5, y5, font5, white)
                x5 += (Font.Width (phrase5 (rep5), font5))
            end for
            exit

        elsif quizanswer2 = "y" or quizanswer2 = "Y" then
            loopquiz
        else
            put "This is not a choice."
            loop
                put "Please select another choice:  " ..
                get quizanswer2
                exit when quizanswer2 = "y" or quizanswer2 = "Y" or quizanswer2 = "n" or quizanswer2 = "N"
            end loop
        end if

    else
        put "This is not a choice."
        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
            put "This is not a choice."
            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 ""
            put "Would you like to do another quiz? (y/n):  " ..
            get quizanswer
            if quizanswer = "n" or quizanswer = "N" then
                cls
                for rep5 : 1 .. length (phrase5)
                    delay (95)
                    Font.Draw (phrase5 (rep5), x5, y5, font5, white)
                    x5 += (Font.Width (phrase5 (rep5), font5))
                end for
                exit

            elsif quizanswer = "y" or quizanswer = "Y" then
                loopquiz
            else
                put "This is not a choice."
                loop
                    put "Please select another choice:  " ..
                    get quizanswer
                    exit when quizanswer = "y" or quizanswer = "Y" or quizanswer = "n" or quizanswer = "N"
                end loop
            end if

        elsif choice = 2 then
            quiz2
            put ""
            put "Would you like to do another quiz? (y/n):  " ..
            get quizanswer2
            if quizanswer2 = "n" or quizanswer2 = "N" then
                cls
                for rep5 : 1 .. length (phrase5)
                    delay (95)
                    Font.Draw (phrase5 (rep5), x5, y5, font5, white)
                    x5 += (Font.Width (phrase5 (rep5), font5))
                end for
                exit

            elsif quizanswer2 = "y" or quizanswer2 = "Y" then
                loopquiz
            else
                put "This is not a choice."
                loop
                    put "Please select another choice:  " ..
                    get quizanswer2
                    exit when quizanswer2 = "y" or quizanswer2 = "Y" or quizanswer2 = "n" or quizanswer2 = "N"
                end loop
            end if


        end if
    end if
end loop


: