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

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




PostPosted: Sat May 24, 2003 5:57 pm   Post subject: label problem

My program runs, but when I choose anything but a (like b or c) the program stops. And it says "case selector is out of range" but,it will let me choose only a.

how do I fix this?????
any help would be great!
thank u



summative2.t
 Description:

Download
 Filename:  summative2.t
 Filesize:  40.08 KB
 Downloaded:  379 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat May 24, 2003 8:00 pm   Post subject: (No subject)

thats because you dont have case "b": or case "c": or anything... cant select something you dont have Confused

Atleast after properly indenting the file, I wasnt able to find those cases...

To be honest... this program layout is horrible. I mean if your last 20 lines are all "end case" you gotta screw up somewhere... and its too hardcoded, which is bad

To better organize it, ether use procedures, or better yet, load up the questions from the files Very Happy
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
cutiegirl_14_16




PostPosted: Sat May 24, 2003 9:22 pm   Post subject: (No subject)

this is the only way I know how 2 make it. We didn't learn any processes, so i had 2 find and figure out the music one on my own. So I don't understand what u mean by use procedures?? wut procedures? and i don't know ne other way 2 put the question' s in.
Sorry, if it was hard to read. Embarassed
Prince




PostPosted: Sat May 24, 2003 10:08 pm   Post subject: (No subject)

u use case an awful lot, sumtimes its not even necessary... and yea, a few functions and/or procedures would clean it up nicely so that the code doesnt look all scrambled like... and so it isnt so wordy create sum text files to keep the information and then load em wen u need to... id like to offer more suggestions but i lost myself tryna read thru the code Confused... but so far it looks like good educational fun (if there is such a thing Twisted Evil)
Tony




PostPosted: Sat May 24, 2003 11:30 pm   Post subject: (No subject)

I've writen a tutorial on procedures... its basically a piece of code that you have condensed into a single "name".

code:

procedure word
put "tony is cool"
end word

put "now calling procedure"
word


so for each question, you just have a procedure writen... so intead of having tons of code to look through, the logical part of your program will be redused to:

code:

case a:
procedureA
case b:
procedureB
end case


much easier to look though.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: