Computer Science Canada case construct...the easy way |
Author: | Tallguy [ Fri Jun 01, 2007 8:23 am ] | ||
Post subject: | case construct...the easy way | ||
Selective structures: Case Construct Case construct is an efficient way to creating menus. It does not however allow the coder to do anything that an if statement can't do; it's just better at handling certain tasks. Try this
Notice that the final label functions similarly to an else. -------------------------------------------------------------------------------------- to practice try these: 1) Write a traffic light program. The traffic light itself should be a graphic. It will flash a light colour at random.Ask the user what colour the light is and output the correct instructions for the chosen light colour. 2) Write a program that will convert the user's weight to the equivalent weight on any other planet.The user should be able to choose which planet. 3) Modify 2 such that a picture of the planet is displayed. |
Author: | Cervantes [ Fri Jun 01, 2007 7:11 pm ] |
Post subject: | RE:case construct...the easy way |
Again, I fixed up the post. Same comments as in the other one apply. |
Author: | Tallguy [ Sat Jun 02, 2007 3:35 pm ] |
Post subject: | RE:case construct...the easy way |
thanks cervantes |