Sure, no problem. In your code, you posted "cout <<" something without declaring the std (standard) namespace. Basically, you referred to something that doesn't exist all by itself in the C++ language, but rather in a standard group of functions. std - the namespace - is defined in iostream, cout is defined as
part of std. So for a program, people would normally write std::cout. Now, if you wanted to write just cout, you would write "using std" before going "cout" something to tell the compiler that if something's not in the list of definitions, look in the std namespace.
Normally, just posting "cout" something is fine because some compilers use std as default , but at least a few ANSI-strict compilers will have problems with that - and a lot of older compilers will have problems with that too. Also, supposing that you made another namespace - say foo for example - and you declared using foo before you declared "cout". Then instead of referring to std::cout, you'd be referring to foo:cout, which is probably not what you want. ~ It's just bad for portability and some style reasons.
Tell me if that makes sense.
Reply