Lektrix is right to tell you not to use *.h for your include file names. The *.h is a little thing left over from C and pre-ANSI/ISO, non-standard C++. Namespaces should be learned at an early stage. The committee that standardized C++ declared it good programming style to use namespaces to prevent conflict from different header files and such with the same name. Which is very much the same as the way overloaded functions are differentiated.
Out of the examples:
#include <iostream> using namespace std; int main() { char r = ''r''; cout << r; return(0); }
... and ...
#include <iostream> int main() { char r = ''r''; std::cout << r; return(0); }
Know both of them (why they work and such), but use the first as extensively as possible. This will keep you code simple and clean. Otherwise (not using namespaces), you could very well end up using std::______ for every statement from iostream or any other include file you decide to use. It gets fairly tiresome (^_^)
I do apologize to anyone who was offended by my usage of *.h. Old habits die hard. (^_^) ~Belgarion
Or you could just pull the needed elements into the global namespace, instead of eliminating its purpose by "using namespace std", which effectively aliases std with the global namespace. Like so:
using std::cout; using std::endl;
Hey, not tiring, and you can prevent global namespace pollution. Sounds like a winner.