Alpha Criticism: Part One......

This is a discussion on Alpha Criticism: Part One...... within the C++ Programming forums, part of the General Programming Boards category; Welcome to part one of the alpha critism series. Here, I will post a source code that I made and ...

Alpha Criticism: Part One......

Welcome to part one of the alpha critism series. Here, I will post a source code that I made and other experience/expert programmers will critism my coding abilities. I like this new concept, it will help me improve my coding style. Here it goes!!!

It's always best to place more comments than you need than to place less.

A very good practice is to comment each function and tell what the parameters do. As for the brace ending comments, they're not really needed unless it makes things clearer for you. But you should comment a bit more. Comments should be placed before the line of code, not after and on the same line. That makes things neater.

Only thing that I found confusing in your code was the inclusion of the c headers stdlib.h and time.h.
If you are going to use these headers ( the program that you supplied does not require them ), then you should use the following code

when you are using #include <iostream> and 'using namespace std' you should use the #include <cstdlib> version.
I am not a hundred percent sure what the exact difference is, though this is what I have been told and found others to do.

By using the using namespace std; statement you effectively tell the compiler all included files are of the std namespace (or global namespace i forgot/dunno)
#include <something.h> is the old C style headers and C++ supports it for the sake of backward compatibility. By specifying a filename instead of an identifier, the compiler automatically treats the included files as if it were in the global namespace (because namespaces weren't supported in C) so using namespace std; is redundant.

But standard C++ encourages the use of identifiers, using namespace std; statements and discourages using .h filenames so I guess its in the spirit of good practice.