Bored? Look over my C++ in class exercise and comment
4 replies, posted
[url]http://pastebin.com/Fh1yzQk1[/url]
Please realize that my time was limited, so what seems to be awkward choices was just really me grasping at anything to find a way to complete it in the time alloted. :3
Basically it reads in a file of integers into an array and then finds out stuff about it (which is printed out at the end of main).
Needs more whitespace
[editline]29th October 2010[/editline]
Also capitalize the first letter of your comment sentence and put a space between it and the //
These statements could be else-ifs:
[code]if(TestFile[i]>max)
if(TestFile[i]==max)[/code]
I would personally argue that there are too many comments which do not have a good enough reason to be there, then again tutors seem to like lots of extra comments. I personally think that comments should describe the [i]reason[/i] for a section, not what that section does. (You're not trying to teach the language with your comments, readers should already know the language - You're trying to explain the purpose of a section.)
[QUOTE=Shammah;25726830]Needs more whitespace
[editline]29th October 2010[/editline]
Also capitalize the first letter of your comment sentence and put a space between it and the //[/QUOTE]
Thanks. Yeah I'm just trying to improve my coding style. :3
[url]http://pastebin.com/DsZG4zkp[/url]
[editline]29th October 2010[/editline]
[QUOTE=yngndrw;25726955]These statements could be else-ifs:
[code]if(TestFile[i]>max)
if(TestFile[i]==max)[/code]
I would personally argue that there are too many comments which do not have a good enough reason to be there, then again tutors seem to like lots of extra comments. I personally think that comments should describe the [i]reason[/i] for a section, not what that section does. (You're not trying to teach the language with your comments, readers should already know the language - You're trying to explain the purpose of a section.)[/QUOTE]
Yeah, my reason is purely for the grader. I completely agree with you. ^.^
Oh and another thing, your current style is inconsistent. For example you are a variable called "import" (No capital.) and a variable called "TestFileLength". (With a capital.)
I also don't personally like the spacing convention that you've used, but it's up to you what you use at the end of the day.
Sorry, you need to Log In to post a reply to this thread.