Computer Science Canada

Neat programs, not all mine though

Author:  slytherz [ Mon Jun 27, 2005 8:27 am ]
Post subject:  Neat programs, not all mine though

take a look and let me know what you think

Author:  Cervantes [ Mon Jun 27, 2005 8:59 am ]
Post subject: 

Looks like you're interested in programming, given the fact that you've posted several programs (I'm assuming at least a few are yours). There are better ways to do lots of those programs, however. For example, instead of using delays while the user reads text, use a bit of code like this:
code:

loop
     exit when hasch()
end loop

If need be, you can put an Input.Flush before that loop.
Also, instead of using
code:
get varName

where varName is a variable of type string, use
code:
get varName : *

This allows strings that contain spaces to be stored in varName. Otherwise, everything after the space is left in the input buffer.
Also, try looking into error-trapping. For example, if you're asking for an integer and I input "qr7", the program will crash. Find a way to prevent that. (loops are good here. So is getch)

If you want to learn more of the fundamentals of programming, check out the Turing Walkthrough.


: