quote: Original post by gamechampionx
BTW, what's std::cout?
What syntax and format should I use? Also, which header files??
It's to do with "namespaces", which are a way to keep parts of your code in a separate place. You've probably been doing this:
#include <iostream.h>
cout << "whatever" << endl;
However, that's actually non-standard (old, inadvisable). Namespaces let you wrap up things, so if you did this:
namespace Something{ void myFunc();}namespace AnotherNamespace{ void myFunc();}
...then you'd access them like this:
Something::myFunc(); // or AnotherNamespace::myFunc();
That can help to reduce conflicts with any code named the same.
The iostream is contained in the namespace "std", which means that you can either do this:
#include <iostream> /* no .h */using namespace std;// from now on, no need for std:: before everything//...or this:#include <iostream>std::cout << "something" << std::endl;
etc.
Namespaces are a way of cleaning up your code. There was a discussion about them over here and here not long ago. Also, have a look over here.
Alimonster
"If anyone can show me, and prove to me, that I am wrong in thought or deed, I will gladly change. I seek the truth, which never yet hurt anybody. It is only persistence in self-delusion and ignorance which does harm." -- Marcus Aurelius
[edited by - Alimonster on March 27, 2002 8:41:46 PM]