Computer Science Canada

fonebook

Author:  Jimbo 420 [ Mon Jun 05, 2006 1:15 pm ]
Post subject:  fonebook

records information to a file creating a fonebook
saves as friends. txt

Author:  Mr. T [ Mon Jun 05, 2006 7:09 pm ]
Post subject:  Alex's Opinion

Mind changing your signature. Naughty

Author:  Clayton [ Mon Jun 05, 2006 8:35 pm ]
Post subject: 

as stated above, plz change ur signature Sad plz read [The Rules] for a description of acceptable signatures, now on to ur program

first of all your first and last name inputs could cause you some trouble ex

Turing:

put "Please enter your first name"
get firstName


this will not cover inputs such as "Joe Bloe" "Suzie Sue" etc, if looking for string input its a good idea to do this

Turing:

put "Please enter first name"
get firstName:*


now about your exit condition

Turing:

exit when firstName="zzz"


this doesnt cover inputs like "zZz" or "ZZZ" etc, its a better idea to use a getch statement or use Str.Upper or Str.Lower to check for exit conditions

check the Turing Walkthrough to find new ways to improve this program and expand your programming skills Very Happy

Author:  _justin_ [ Tue Jun 06, 2006 11:31 am ]
Post subject: 

accutly for his exit statement the teacher told us to just use zzz as a exit Cool

Author:  wtd [ Tue Jun 06, 2006 12:21 pm ]
Post subject: 

So if your teacher tells you to program poorly, you'll place complying with that more highly than getting a good education?

One of the most important things to remember when writing a program is that it must be robust. One component of this is that your program should work correctly, even with input that is slightly different than you were expecting.

User input can never be trusted to be perfectly formatted.

In this case, it's also very easy to make your program more robust. Simply make the entire input string lower-case, then check to see if it equals "zzz". This will catch "Zzz", "zZz", etc.

Author:  TheOneTrueGod [ Tue Jun 06, 2006 2:34 pm ]
Post subject: 

Unfortunately, some teachers can be quite stubborn. For example, My grade 10/11 compsci teacher wouldn't let us use anything with a "." in it. That includes things like View.Set or Input.KeyDown... Or Str.Lower in this case. (I know you can just create your own Str.Lower function, but for something like Input.KeyDown, it could mean remaking the entire program...)

Still, you shouldn't post in-school assignments without polishing them up first. (Or anything really... Razz)

Author:  _justin_ [ Tue Jun 06, 2006 3:44 pm ]
Post subject: 

yea i see what you guys mean it is just that the teacher always says use "zzz" as the senital

but wtd you make a real good point here


: