I'm confused regarding regarding 'using namespace std;' Can you help me get the concept??
Also, I wanted 2 print the following pattern using setw() manipulator, but it didn't work properly, can anyone help??
namespaces are just a way to avoid polluting the global namespace with a lot of symbols.
so cout, for example, rather than being in the global namespace is declared in the std namespace.
Which is why you have to type std::cout to refer to it.
For those programmers who don't want to continually have to type "std::", the above directive says to the compiler that any symbol in the std namespace should be considered to be in the global namespace.
In other words, you can write your own library with it's own object named cout and put it in your own namespace. Then, in a single program you could use either cout by specifying std::cout or own::cout...