+10

C plus plus

I prefer using namespace std; Than using std::cout , in every line of code Which one is good for better and nice code please need help

11/5/2019 2:30:55 PM

Chizy

12 Answers

New Answer

+2

From what I’ve learned so far, the use of “using namespace std” is considered a bad practice. Especially if you declare it in a global scope. Now the question remains, why? Surely, this statement saves us from typing std:: every time, but all the contents of the std will be imported into the current namespace of the program, which in turn creates naming conflicts. It’s quite ironic because it was created to remove name ambiguity in the first place. For a beginner though, clearing concepts in depth for any programming language is like opening a can of worms, the detailed explanation would end up raising more questions than answers. Just don’t make a habit of implementing “using namespace std” for now.

+6

The video is kind of advance but the way you explained it I understand thank you for your time and consideration

+5

Well those are not mine videos I just watch them to learn too 😁

+4

https://www.sololearn.com/discuss/1316935/?ref=app

+3

Watch those two and you'll know what are namespaces and why you shouldn't use 'using namespace std' https://m.youtube.com/watch?v=ts1Eek5w7ZA https://m.youtube.com/watch?v=4NYC-VU-svE

+3

Hi @karim

+2

using namespace is cleaner. also look into alias i think you will benefit from that utility.

+2

using "using namespace std;" is better

+2

I see a lot of "using namespace std is better" but according to pros, it isn't, like @nAutAxH AhmAd said. I think it's because it can confuse the compiler sometimes. But honestly, I'm still comfortable with "using namespace std".

+1

Hello my name is karim

+1

Thanks

0

🤭.. 😄 HI!!!