Try to not declare a variable until just before it is used.
This isn't C.� See section 3.3 of the style guide for more info.
Try to initialize all variables when they are declared.
Again, a common problem with old C programmers.
Start loops at zero.
Start for loops at zero if you can.� This usually makes your programming life easier in
the long run.
Use a for loop any time that you know in advance how many times you are going to do a loop
And in this assignment, you know in advance that you will write the name 100 times.
If you have a lot of computations inside of your loop that always
come up with the same result, it would be wise to move that computation outside of the
loop, store it in a variable and refer to that variable inside the loop.
Double check what the class name should be for the assignment.
Use the name of the assignment (also seen in the sentence "In other words, I want to type ...")
Don't add extra stuff unless specifically mentioned ( the KISS principle ).
You can easily make this program test for a million things and the program would be two
million lines long.� But realistically, this program is for you to get a tiny amount of
exercise using loops and, for the second half, math.� You don't need to test for
multiple names, or if the name is too big.� You are the only person that will be running
the program.� If you choose to pass in bizarre data, it is okay if the program crashes.
OOP is a great thing. But that doesn't mean it's the best solution for all problems.
The important thing is good, simple, clean, readable code. In this case, adding object
stuff just complicates things.
Page maintained by
[url=https://coderanch.com/wiki/659748/ActiveStaffMarilyn de Queiroz[/url]
Good night. Drive safely. Here's a tiny ad for the road: