why this line is been used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why this line is been used?

#include <iostream> "using namespace std;" int main() { cout << "Hello world!"; return 0; }

31st Jan 2017, 1:03 AM
GOWTHAMAN A
GOWTHAMAN A - avatar
2 Answers
+ 2
take it out and see what error it gives :)
31st Jan 2017, 1:52 AM
jay
jay - avatar
+ 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.
31st Jan 2017, 6:17 AM
Cohen Creber
Cohen Creber - avatar