Computer Science Canada

Who Wants to be a Millionaire.....if-elsif statements!!!!!

Author:  balla16 [ Wed May 19, 2004 6:36 pm ]
Post subject:  Who Wants to be a Millionaire.....if-elsif statements!!!!!

I am currently doing my 30% summative now and have been assigned to do the game "Who wants to be a Millionaire." I have done all my graphics but I am having trouble setting up my if-elsif statements. The 5 choices
I have are (1) 50/50 (2) Ask-The-Audience (3) Phone a friend (4) Correct answer or (5) Wrong answer. I am ending up with if statements within if statements within if statements etc.... Can someone help me out here????
Bare with me, I am new at this...

Author:  SuperGenius [ Wed May 19, 2004 7:05 pm ]
Post subject: 

if you post code we will be able to help you better rather than just guessing your problem

Author:  balla16 [ Thu May 20, 2004 10:02 pm ]
Post subject: narrowing my help down even more....i know have my structure as a "procedure" but i don't know how to make the procedure run only once and never again.

For example, if you use 50/50, i don't want the procedure to run those instructions do i do it?????

Author:  not_l33t [ Fri May 21, 2004 12:42 pm ]
Post subject: 

Dude your comming pretty close to being in the "Hall of Shame".

Author:  octopi [ Fri May 21, 2004 1:04 pm ]
Post subject: 


he is comming no where close to the hall of shame.

okay, if you want to limit it so that you can only use the 50/50 once, phone once, and poll the audience once, then you need to make 3 variables at the top of your program


or something similar.

now, when someone selects the 50/50 in there you need to set that variable
5050used equal to a certain value. (doesn't matter what value)

then where you have if statements like

elsif Answer1 = "1" then
make that
elsif ((Answer1 = "1") and (5050used not= THEVALUEABOVE)) then

where THEVALUEABOVE is the certain value that gets assigned to the 50/50 thing once its been used.

do you understand what is happening?

when you use the 5050 it records that it has been used, now, the next time someone tries to use it, it makes sure it hasn't been used yet.

Author:  MyPistolsIn3D [ Fri May 21, 2004 2:50 pm ]
Post subject: 

or make a boolean variable for each like:

phone : boolean := true

then when they select to use the phone:

if phone = true then
   (phone procedure)
   put "sorry you've already used the phone"
end if

Author:  balla16 [ Fri May 21, 2004 11:41 pm ]
Post subject:  Thanks!

Thanks a lot "MyPistolsIn3D" and "Octopi".....its nice to see people helping new programmers unlike other who come to criticize *not_l33t*