Using namespace std

I had these questions for a while now so I thought I had to ask somewhere.

  1. What does ‘using namespace std’ mean in C++?
  2. why does the program give compilation error when it is not used?

The typical syntax of statements like con, cout etc is “std::cin>>a”

With using namespace std, you can avoid writing that “std::” part everytime. Without it, std:: must be written else it gives a compilation error.

This Q can be easily googled too, make sure you give googling an attempt as well for syntax related issues.

1 Like

Using the using keyword doesn’t mean we add functionality, it means we say that we read things by default. If we say using namespace std; then we say: If we come across an object name that doesn’t exist in our current namespace, check if there exists a namespace std in which it does exist, and use that object. Thus, it doesn’t really add a function, it is the include that “loads” cout, cin, endl and all the like.

1 Like

I think we should downvote such questions… people are using it to get fake up votes… -_-

1 Like

I have to give a benefit of doubt for beginners, but rest assured, I am keeping a track of situation from my side. :slight_smile:

coming straight at the point, i guess he thinks that this id is one of ours , ask codechef to verify the ip adress @admin :slight_smile: that will assure you. if helping begiiners is a problem to you , i guess then no one should have helped you when you were a begiiner at coding :slight_smile: