using namespace....?

In the tutorials the author has used 'using namespace std' everywhere..
He/She has also had written the explanation in the beginning...in structure of programes'.....i didn't understand that completely...
Someone please explain me why 'using namespace std' is used
To use the C++ function "cout" to write some data into the console you have to use:

std::cout << "hello world";

& to use any member of the "std" namespace, you have to use this.
Like std::endl for a new line.

Using "using namespace std" means you don't have to write "std::" in front of all of these & thus it just becomes:

cout << "hello world" << endl;

It's just a bit of a space saver.
Why is it necessary to write

std::cout<<"hello";

till now whenever i used cout, i used to write it as
cout<<"hello";

directly and i found no errors....

please explain...........
In old standard headers there wasn't the std namespace, in new header it is there.

I think you should read the namespace part of the tutorial ( http://www.cplusplus.com/doc/tutorial/namespaces.html ) if you want to understand better how namespaces work
Thanks for answering.......

I'll read it .......in case i get doubts.................i''l ask..............
Topic archived. No new replies allowed.