Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Problems with my home project
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
y2hitman3




PostPosted: Wed Nov 26, 2003 8:07 pm   Post subject: Problems with my home project

hey i'm having trouble with my home project it's Who Wants to be a millionaire. I'm wondering about how i would add in the exit effect. here's all i've done so far.

var name:string
var ans:string
put "Welcome to Who Wants to be a Millionaire!"
put "I'm Regis Philbin and what's your name?"
get name
put "Welcome to Who Wants to be a Millionaire, "..
put name
put "How are you?"
get ans
put "That's great!"
put "Start the round?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
put "LET'S PLAY WHO WANTS TO BE A MILLIONAIRE!!"
end if
put "All answers must be the letters they correspond with."
put "Are you ready "..
put name
put "(y/n)"
get ans
if ans = "y" or ans = "Y"
then
cls
end if
put "For $100, who is known as the 'Great One' of hockey?"
put "A: Gordie Howe"
put "B: Mark Messier"
put "C: Doug Gilmour"
put "D: Wayne Gretzky"
get ans
if ans = "d" or ans = "D"
then
put "You're the 'Great One' of this game it seems!"
put "(crowd laughs)"
elsif ans = 'a' or ans = 'A'
then
put "Sorry 'Mr. Hockey', that's the wrong answer. I see you probably sit at home on your couch watching cooking shows..."
elsif ans = 'b' or ans = 'B'
then
put "Sorry 'Moose', that's the wrong answer. I'm sure your buddies in the forest could have helped you..."
elsif ans = 'c' or ans = 'C'
then
put "Although Doug Gilmour is one of the greatest players EVER, he's not known as the 'Great One' although he should damn well be..."
end if
put "Continue?(y/n)"
get ans
if ans = "y" or ans = "Y"
then
cls
end if
put "For $200, the term microprocessor is used mostly with what component?"
put "A: TV"
put "B: Toliet"
put "C: Baseball Cards"
put "D: Computers"
get ans
if ans = 'd' or ans = 'D'
then
put "Easy question"
elsif ans = 'a' or ans = 'A'
then
put "So close yet so far..."
elsif ans = 'b' or ans = 'B'
then
put "You must be really old and stupid!!!"
put "You probably were still alive when people shat everywhere!!!"
elsif ans = 'c' or ans = 'C'
then
put "(Regis gets up and leaves)"
put "(Regis yells in the back)"
put "Where the hell do you find these idiots from!?!??!"
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
put "For $500, what is the word in this line:"
put "_____, I am your father"
put "A: Dawg"
put "B: Mother"
put "C: Luke"
put "D: Luck"
get ans
if ans = 'c' or ans = 'C'
then
put "CORRECT FOR $500!!!"
elsif ans = 'a' or ans = 'A'
then
put "Listen 'dawg', I'm sure you and your 7 - 8 siblings, oh sorry, HOMIES all are called dawg by your father but that's off the hizzle fo shizzle!"
elsif ans = 'b' or ans = 'B'
then
put "..."
put "(Regis gets up and leaves)"
put "(Regis yells from the back)"
put "ANOTHER STUPID KID!!! Where do you get these fools from!!!"
elsif ans = 'd' or ans = 'D'
then
put "WOW!!! You came so close. Maybe what you should do is buy a hearing aid with the money you win."
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
put "For $1000, who are the biggest rivals in professional Men's Tennis?"
put "A: Tim Henman & Carlos Moya"
put "B: Tim Henman & Jarri Kurri"
put "C: Andre Agassi & Pete Sampras"
put "D: Serena & Venus Williams"
get ans
if ans = 'c' or ans = 'C'
then
put "You like watching men in short shorts don't you?"
put "(Crowd laughs)"
elsif ans = 'a' or ans = 'A'
then
put "Two of the greatest players although they aren't rivals..."
elsif ans = 'b' or ans = 'B'
then
put "That's only be right if tennis was played on ICE!!"
elsif ans = 'd' or ans = 'D'
then
put "Well, if this was women's tennis..."
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
put "For $2000, who was credited for the invention of computers?"
put "A: Sir Charles Baggage"
put "B: Sir Charles Babbage"
put "C: Lady Lovelace"
put "D: Bill Gates"
get ans
if ans = 'b' or ans = 'B'
then
put "You should be the inventor of 'Genuis'!!"
elsif ans = 'a' or ans = 'A'
then
put "If anything was invented it was the confusing of "..
put name
elsif ans = 'c' or ans = 'C'
then
put "Lady Lovelace was the inventor of the first computer language. Her name was also Ada. If I was to add your score based on this question you'd have ZEROOOOOO!"
put "(crowd laughs)"
elsif ans = 'd' or ans = 'D'
then
put "If anything, Bill Gates probably bought Microsoft from a hobo..."
put "(crow goes histerical)"
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
put "For $5000, in the movie 'The Fast and the Furious' the term NOS stands for what?"
put "A: Nitrous Oxide System"
put "B: National Orthodonto Society"
put "C: Nitrous Oxide"
put "D: Nitro Oxigen System"
get ans
if ans = 'a' or ans = 'A'
then
put "What is it with you and sitting on your ass watching movies?"
put "(crowd laughs)"
elsif ans = 'b' or ans = 'B'
then
put "I'm assuming that you were never really schooled, "..
put name
elsif ans = 'c' or ans = 'C'
then
put "..."
put "(Regis gives "..put name ," a book)"
put "Here that's a spelling book my 7-year-old daughter uses. Go learn to read."
elsif ans = 'd' or ans = 'D'
then
put "What were you doing during the movie?"
get ans
put "Yeah sure... I'm sure you were trying something or another..."
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
put "For $10,000, which artist wrote the song 'When Doves Cry'?"
put "A: Prince"
put "B: Michael Jackson"
put "C: Celine Dion"
put "D: Sheryl Crow"
get ans
if ans = 'a' or ans = 'A'
then
put "You should be the 'Answerer-Formerly-Known-as-Prince'"
elsif ans = 'b' or ans = 'B'
then
put "Maybe you'd like us to send some kids up to room later?"
elsif ans = 'c' or ans = 'C'
then
put "If anything is going on with your stupidity then it's the next contestant!"
elsif ans = 'd' or ans = 'D'
then
put "Run Boy Run, cause that answer ain't right!!"
end if
put "Continue?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
then
cls
end if
____________________________________________________________

i need to know how to add in the exit effect and if anyone knows how to make it so that the program will add how much money the person won at the end.
Sponsor
Sponsor
Sponsor
sponsor
msoccer




PostPosted: Wed Nov 26, 2003 8:34 pm   Post subject: (No subject)

I'm new the site, and just taking Turing this year, however I do some assembly, and machine code - so I'll take a stab at this.

For the Exit Part create a loop at the very start, and put exit when and end loop conditions after each wrong answer.

For example

if ans="a" then
put "What a moron, correct answer is b"
exit when ans=a
end loop

--------------

For the money part, simply create a variable at the top called money, and for each right answer after the if statement include something like this

if ans="a" then
put "Corect"
money:=money+1000*

*Note, here you would put how much that question is worth
--------------

Hope some of this could be of help!
Thuged_Out_G




PostPosted: Thu Nov 27, 2003 11:26 am   Post subject: (No subject)

try hittin f2 in turing, and maybe put a space or 2 inbetween your if statements and your questions...t just makes it a bit easier to read and follow
Thuged_Out_G




PostPosted: Thu Nov 27, 2003 11:32 am   Post subject: (No subject)

and maybe put each of your questions inside a function, and then call them question1, question2, question3 etc

if you dont know how to do a function here it is

code:

fcn question1 (ans : string) : string
    if ans = "d" or ans = "D"
            then
       result "You're the 'Great One' of this game it seems! (crowd laughs)" 
       
    elsif ans = 'a' or ans = 'A'
            then
      result "Sorry 'Mr. Hockey', that's the wrong answer. I see you probably sit at home on your couch watching cooking shows..."
    elsif ans = 'b' or ans = 'B'
            then
     result "Sorry 'Moose', that's the wrong answer. I'm sure your buddies in the forest could have helped you..."
    elsif ans = 'c' or ans = 'C'
            then
    result "Although Doug Gilmour is one of the greatest players EVER, he's not known as the 'Great One' although he should damn well be..."
    end if
end question1


then in your code, where all those if statements were, just use this

code:

put question1(ans)
[/code]
Andy




PostPosted: Thu Nov 27, 2003 11:39 am   Post subject: (No subject)

yea have the whole thing in a loop, and have an exit statement if the answer is not rite.
suggestion: you should use arrays and records. to learn records read my tutorial, to learn arrays read my tutorial. both in the tutorial section.

you should have the question, the choices, and the correct answers in the record, then you can just run the whole thing in a loop. much much easier.
Thuged_Out_G




PostPosted: Thu Nov 27, 2003 5:53 pm   Post subject: (No subject)

DEFINATLY not the best method, but it works(i think) hehe

code:

var name, ans : string
var money :=0
var winID := Window.Open ("position:top,center,notoolbar,graphics:640;640")

proc question1
    put "For $100, who is known as the 'Great One' of hockey?"
    put "A: Gordie Howe"
    put "B: Mark Messier"
    put "C: Doug Gilmour"
    put "D: Wayne Gretzky"
    get ans
    if ans = "d" or ans = "D"
            then
        put "You're the 'Great One' of this game it seems!(crowd laughs)"
        money := money + 100
    elsif ans = 'a' or ans = 'A'
            then
        put "Sorry 'Mr. Hockey', that's the wrong answer. I see you probably sit at home on your couch watching cooking shows..."
    elsif ans = 'b' or ans = 'B'
            then
        put "Sorry 'Moose', that's the wrong answer. I'm sure your buddies in the forest could have helped you..."
    elsif ans = 'c' or ans = 'C'
            then
        put "Although Doug Gilmour is one of the greatest players EVER, he's not known as the 'Great One' although he should damn well be..."
    end if
    delay (1000)
    cls
end question1

proc question2
    put "For $200, the term microprocessor is used mostly with what component?"
    put "A: TV"
    put "B: Toliet"
    put "C: Baseball Cards"
    put "D: Computers"
    get ans
    if ans = 'd' or ans = 'D'
            then
        put "Easy question"
        money := money + 200
    elsif ans = 'a' or ans = 'A'
            then
        put "So close yet so far..."
    elsif ans = 'b' or ans = 'B'
            then
        put "You must be really old and stupid!!! You probably were still alive when people shat everywhere!!!"
    elsif ans = 'c' or ans = 'C'
            then
        put "(Regis gets up and leaves)---(Regis yells in the back)---Where the hell do you find these idiots from!?!??!"
    end if
    delay (1000)
    cls
end question2

proc question3
    put "For $500, what is the word in this line:"
    put "_____, I am your father"
    put "A: Dawg"
    put "B: Mother"
    put "C: Luke"
    put "D: Luck"
    get ans
    if ans = 'c' or ans = 'C'
            then
        put "CORRECT FOR $500!!!"
        money := money + 500
    elsif ans = 'a' or ans = 'A'
            then
        put "Listen 'dawg', I'm sure you and your 7 - 8 siblings, oh sorry, HOMIES all are called dawg by your father but that's off the hizzle fo shizzle!"
    elsif ans = 'b' or ans = 'B'
            then
        put "...(Regis gets up and leaves)(Regis yells from the back)ANOTHER STUPID KID!!! Where do you get these fools from!!!"
    elsif ans = 'd' or ans = 'D'
            then
        put "WOW!!! You came so close. Maybe what you should do is buy a hearing aid with the money you win."
    end if
    delay (1000)
    cls
end question3

proc question4
    put "For $1000, who are the biggest rivals in professional Men's Tennis?"
    put "A: Tim Henman & Carlos Moya"
    put "B: Tim Henman & Jarri Kurri"
    put "C: Andre Agassi & Pete Sampras"
    put "D: Serena & Venus Williams"
    get ans
    if ans = 'c' or ans = 'C'
            then
        put "You like watching men in short shorts don't you?(Crowd laughs)"
        money := money + 1000
    elsif ans = 'a' or ans = 'A'
            then
        put "Two of the greatest players although they aren't rivals..."
    elsif ans = 'b' or ans = 'B'
            then
        put "That's only be right if tennis was played on ICE!!"
    elsif ans = 'd' or ans = 'D'
            then
        put "Well, if this was women's tennis..."
    end if
    delay (1000)
    cls
end question4

proc question5
    put "For $2000, who was credited for the invention of computers?"
    put "A: Sir Charles Baggage"
    put "B: Sir Charles Babbage"
    put "C: Lady Lovelace"
    put "D: Bill Gates"
    get ans
    if ans = 'b' or ans = 'B'
            then
        put "You should be the inventor of 'Genuis'!!"
        money := money + 2000
    elsif ans = 'a' or ans = 'A'
            then
        put "If anything was invented it was the confusing of ", name
    elsif ans = 'c' or ans = 'C'
            then
        put "Lady Lovelace was the inventor of the first computer language. Her name was also Ada. If I was to add your score based on this question you'd have ZEROOOOOO!(crowd laughs)"
    elsif ans = 'd' or ans = 'D'
            then
        put "If anything, Bill Gates probably bought Microsoft from a hobo...(crow goes histerical)"
    end if
    delay (1000)
    cls
end question5

proc question6
    put "For $5000, in the movie 'The Fast and the Furious' the term NOS stands for what?"
    put "A: Nitrous Oxide System"
    put "B: National Orthodonto Society"
    put "C: Nitrous Oxide"
    put "D: Nitro Oxigen System"
    get ans
    if ans = 'a' or ans = 'A'
            then
        put "What is it with you and sitting on your ass watching movies?(crowd laughs)"
        money := money + 5000
    elsif ans = 'b' or ans = 'B'
            then
        put "I'm assuming that you were never really schooled, " ..
    elsif ans = 'c' or ans = 'C'
            then
        put "...(Regis gives ", name, " a book) Here that's a spelling book my 7-year-old daughter uses. Go learn to read."
    elsif ans = 'd' or ans = 'D'
            then
        put "What were you doing during the movie? Yeah sure... I'm sure you were trying something or another..."
    end if
    delay (1000)
    cls
end question6

proc question7
    put "For $10,000, which artist wrote the song 'When Doves Cry'?"
    put "A: Prince"
    put "B: Michael Jackson"
    put "C: Celine Dion"
    put "D: Sheryl Crow"
    get ans
    if ans = 'a' or ans = 'A'
            then
        put "You should be the 'Answerer-Formerly-Known-as-Prince'"
        money := money + 10000
    elsif ans = 'b' or ans = 'B'
            then
        put "Maybe you'd like us to send some kids up to room later?"
    elsif ans = 'c' or ans = 'C'
            then
        put "If anything is going on with your stupidity then it's the next contestant!"
    elsif ans = 'd' or ans = 'D'
            then
        put "Run Boy Run, cause that answer ain't right!!"
    end if
    delay (1000)
    cls
end question7

put "I'm Regis Philbin and what's your name?"
get name
cls
put "Welcome to Who Wants to be a Millionaire, ", name
delay (500)
cls

put "Start the round?(y/n)"
get ans
if ans = 'y' or ans = 'Y'
        then
    put "LET'S PLAY WHO WANTS TO BE A MILLIONAIRE!!"
else
    Window.Close (winID)
end if

put "All answers must be the letters they correspond with."
put "Are you ready ", name, "(y/n)"
get ans
cls

if ans = "y" or ans = "Y" then
   question1
else
    Window.Close (winID)
end if

 question2
 question3
 question4
 question5
 question6
 question7
 
 put "Total money earned: $", money
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: