0
why this line is been used?
#include <iostream> "using namespace std;" int main() { cout << "Hello world!"; return 0; }
2 Answers
+ 2
take it out and see what error it gives :)
+ 2
Using namespace std:
cout << "Hello world!" << endl;
Without using namespace std:
std::cout << "Hello World!" << std::endl;
As you can see, when we use a namespace, it just makes it easier for use so we don't have to specify what namespace the member we are trying to use is from via the scope resolution operator (::).
In practice, you should avoid using entire namespaces for conflicting reasons. Though generally, this rule is disregarded for the standard library, as developers pretty much know not to create anything that would cause conflict with it.