Case Statement?? Help!
Author |
Message |
1212
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Wed Jun 02, 2010 10:18 pm Post subject: RE:Case Statement?? Help! |
|
|
Please only post the same topic once. Four is a bit much. |
|
|
|
|
|
Kharybdis
|
Posted: Fri Jun 04, 2010 7:00 am Post subject: RE:Case Statement?? Help! |
|
|
There's a limit.. but it's pretty big. |
|
|
|
|
|
musicman
|
Posted: Fri Jun 04, 2010 9:30 am Post subject: Re: Case Statement?? Help! |
|
|
heres an updated version of your code. i changed some stuff and added some.
Turing: |
%EDITED BY THE MUSICMAN
%set up as a procedure simply so that you have a fail-safe 'OTHER' option
procedure mainmenu
var command : int
var input : string
put "Press 1 for A"
put "Press 2 for B"
put "Press 3 for C"
%I added this check syntax. not needed but i thought you would find it helpful.
%it checks whether or not the input is an integer.
%You can remove this if you want.
loop
get input
exit when strintok (input )
cls
put "Not a number. Try again."
end loop
command := strint (input )
case command of
label 1 :
%Replace this put command with your first program
put "1"
label 2 :
%Replace this put command with your second program
put "2"
label 3 :
%Replace this put command with your third program
put "3"
label :
%Error-proofing...always helpful :)
put "Invalid Input. Try again"
mainmenu
end case
end mainmenu
mainmenu
|
try making all of your subprograms procedures and then just declaring the procedure after each label.
hope this helps.
if you have any more questions feel free to ask.
from, THE MUSICMAN |
|
|
|
|
|
|
|