+ 11

What is the meaning of using namespace in iostream library??

Using namespace std;

24th Jun 2019, 4:22 PM
vikram Kumar
vikram Kumar - avatar
2 Antworten
+ 8
Using namespace std Std means "standard". When you want to use terms like cin and cout, it would be easier if you put "using namespace std" at the beginning and you can use it as usual. Else, whenever you want to use cin and cout,you have to write it this way : std::cin and std::cout. You can try refering here : https://stackoverflow.com/questions/18914106/what-is-the-use-of-using-namespace-std
25th Jun 2019, 7:12 AM
Joey Lim
Joey Lim - avatar
+ 7
I agree with Joey, although using namespace statements are usually not considered good practice. They can add a lot into the global scope, and while it may look cleaner in the code, it is less specific about what you are referring to and can improve chances of causing name collisions. If there is a specific property you want, say std::cout, you could do: using std::cout; This would allow cout << ...; as with a using namespace, except only adds one function to the global scope.
26th Jun 2019, 2:09 AM
JS Coder