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

Username:   Password: 
 RegisterRegister   
 Who Wants to be a Millionaire.....if-elsif statements!!!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
balla16




PostPosted: 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...



Final Game.t
 Description:
This is my progress so far....Remember I i am in my first year of learning turing so most of the commands will be very easy and simple.....If you look, i have the basic if structures but i don't know where to go from there.....

Download
 Filename:  Final Game.t
 Filesize:  16.04 KB
 Downloaded:  314 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
SuperGenius




PostPosted: Wed May 19, 2004 7:05 pm   Post subject: (No subject)

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




PostPosted: Thu May 20, 2004 10:02 pm   Post subject: (No subject)

ok.....im 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 again.....how do i do it?????
not_l33t




PostPosted: Fri May 21, 2004 12:42 pm   Post subject: (No subject)

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




PostPosted: Fri May 21, 2004 1:04 pm   Post subject: (No subject)

not_l33t

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



balla16:
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

code:
5050used
pollused
phoneused


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

code:
elsif Answer1 = "1" then
make that
code:
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.
MyPistolsIn3D




PostPosted: Fri May 21, 2004 2:50 pm   Post subject: (No subject)

or make a boolean variable for each like:

code:
phone : boolean := true


then when they select to use the phone:

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




PostPosted: 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*
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  [ 7 Posts ]
Jump to:   


Style:  
Search: