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

Username:   Password: 
 RegisterRegister   
 I'm a Failure at Case Statements
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fail@ICS




PostPosted: Mon May 24, 2010 11:57 am   Post subject: I'm a Failure at Case Statements

Hey guys:D

So I'm a failure at turing and everything so I was hoping for a bit of help.

I'm supposed to create a slideshow of some sort using turing right. And so I have done a menu page/table of contents page, whatever you wanna call it. I've put an A (then -name of topic), B (then name of topic),C (then name of topic) and so on. So for instance if my slideshow was on sports, A-could be hockey, B-could be basketball, C- rugby and yeah, you get the point:)

Now I want it so that whichever alphabet the user types from A,B,C,D etc, the information within is displayed. I think I need like case statements or if statements for it. I have no idea what to do though. So for instance if the user clicks A, the information for hockey is displayed. I have pictures too and I don't know if case statements display the pictures and stuff. I think it only displays text. Please help someone:(
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon May 24, 2010 12:19 pm   Post subject: RE:I\'m a Failure at Case Statements

You should have a procedure that displays stuff, and have the case statement call the procedure.
code:

proc drawStuff
 Pic.Draw ("pic.bmp", x, y, picMerge)
end drawStuff


case input
    label "A" : drawStuff
end case


My syntax is off but you get the idea.
Fail@ICS




PostPosted: Mon May 24, 2010 12:42 pm   Post subject: Re: I'm a Failure at Case Statements

Dude you're awesome. Thanks a lot for the effort:) But for some reason I still don't get it:(
Tony




PostPosted: Mon May 24, 2010 12:45 pm   Post subject: RE:I\'m a Failure at Case Statements

Sure, no problem. What part do you still have trouble with? Can you get an example, such as the one Insectoid is talking about, to work and understand what is going on?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Kharybdis




PostPosted: Tue May 25, 2010 7:14 am   Post subject: Re: I'm a Failure at Case Statements

Ok, if you want to do loads of stuff in one option of a case statement, you'll need to create a procedure to contain all that stuff within one of those options.

Say that you choose hockey (represented by A in the case statement).

Turing:

proc hockeyProcedure
    /*display all the stuff here*/
end proc

case input
    label "A" : hockeyProcedure
end case



You can have pictures or anything you want inside that procedure that you call when using the case.
Insectoid




PostPosted: Tue May 25, 2010 5:36 pm   Post subject: RE:I\'m a Failure at Case Statements

I can't help but wonder if you even read any posts other than the first...You damn near copied my code snippet exactly.
supaphreek




PostPosted: Wed Jun 02, 2010 8:29 am   Post subject: RE:I\'m a Failure at Case Statements

Well, im not the best at turing but what you could do is draw an A using the drawfont command, then use

Mouse.Where (x,y,button)
if x > (the the left coordinate of the A) and x < (the right coordinate of A) and y > the bottom coordinate of a) and y < (the top coordinate of A) and button = 1 then

put "Hockey...."
end if

As for the when theyre typing it. You could just use getchar

sooo itd be like this

var a : char

a := getchar

if a = "a" or a = "A" then
put "hockey"
end if


BTW, you have to loop BOTH of these
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: