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

Username:   Password: 
 RegisterRegister   
 Selection Construct
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kelsey




PostPosted: Wed Dec 15, 2004 7:06 pm   Post subject: Selection Construct

I'm doing a worksheet for class, and my teacher has *forgotten* (yet again) to explain things to us. I am wondering what a selection construct is, and how do i use it?
Sponsor
Sponsor
Sponsor
sponsor
SuperGenius




PostPosted: Wed Dec 15, 2004 8:01 pm   Post subject: (No subject)

I've never heard of one but it sounds to me like an if structure which will take a certain action based on what input it gets. ex:
code:

if input = 1 then
     proca()
elsif input = 2 then
     procb()
elsif input = 3 then
     procc()
else
     procd()
end if


this code would run a procedure called proca if the variable input has a value of one, and so one. If input is not equal to 1,2 or 3 then it will call procd
wtd




PostPosted: Wed Dec 15, 2004 11:54 pm   Post subject: (No subject)

SuperGenius wrote:
I've never heard of one but it sounds to me like an if structure which will take a certain action based on what input it gets. ex:
code:

if input = 1 then
     proca()
elsif input = 2 then
     procb()
elsif input = 3 then
     procc()
else
     procd()
end if


this code would run a procedure called proca if the variable input has a value of one, and so one. If input is not equal to 1,2 or 3 then it will call procd


More likely the construct in question is:

code:
case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case
Kelsey




PostPosted: Thu Dec 16, 2004 12:02 am   Post subject: (No subject)

Thank-you both, I guess I'll have to clarify with my teacher.
SuperGenius




PostPosted: Thu Dec 16, 2004 4:25 pm   Post subject: (No subject)

wtd wrote:

More likely the construct in question is:

code:
case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case


hmph. I feel cheated out of an education because of all of the things that I never learned.
wtd




PostPosted: Thu Dec 16, 2004 4:45 pm   Post subject: (No subject)

SuperGenius wrote:
wtd wrote:

More likely the construct in question is:

code:
case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case


hmph. I feel cheated out of an education because of all of the things that I never learned.


The key is never to leave a classroom feeling like you've learned everything there is to learn. If you never go beyond what your professor tells you, then there was no point in taking the class. Any job you'll be able to do, your professor could have done, and faster and better at that.

Use Google. Use usenet and the vast number of comp.lang.* newsgroups. There are lots of resources out there just waiting for someone to use them to expand their knowledge.
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: