Is it compulsory to use "using namespace std" in new version !?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is it compulsory to use "using namespace std" in new version !??

I tried " Try yourself" in which it give an error , but where as it does not give any error in turbo C .

21st Feb 2017, 9:49 AM
Ruchita Shah
3 Answers
+ 9
It is not compulsory to do "using namespace std". It never has been. Just do: std::cout std::endl etc for objects which require it, if you are not declaring the use of std namespace for the program.
21st Feb 2017, 1:57 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
It's true that turbo c++ and many of older compiler don't give error messages when using namespace STD is not included. But the new compilers and all the online compilers will give error if you exclude the statement.
21st Feb 2017, 9:56 AM
Megatron
Megatron - avatar
0
What is the error that you are getting? Also in which "try yourself" did you check?
21st Feb 2017, 9:53 AM
SinnerMan
SinnerMan - avatar