C++ wrote:Class projects....
Commenting also helps you understand your programs later on. Write a 1000 line program, don't comment it at all, go back to it 3 months later and you won't be able to tell what your program's doing, it'll take a couple of hours to figure things out. But if you comment everything, you can easily read the comments and in minutes you'll know what the code is doing. The same applies if another person is reading your code.
You should comment every variable, stating what it is for
Comment every loop stating the conditions and what it does
Comment every function stating what it takes as parameters, what it does, and what it returns, if any.
Put a comment on top of your program stating the name of the program, your name, last modification date, starting date, purpose of the program, and anything else you feel is important.
lol i have like a 2000-3000 line program i havent worked on for ~5-6 months, i go back to it and its still very easy to understand :-]
although my word count program is hard as hell to understand (for me, slow mind :-p)
if you want to see it, this is it
http://poop.mine.nu/wordcount.txt
anyways, comments just arent my style :-\
*edit*
also, i dont take a programming class so i just dont need to comment :-\