Hello Garm,
This is generally a copy and paste I use:
Try to avoid using using namespace std; in your programs it may seem easy now, but WILL get you in trouble some day.
It is better to learn to qualify what is in the standard name space with "std::" and then to learn what is in the standard name space now while it is easy. And not all at once to try to keep a job.
What you are most likely to use for now is "std::cout", "std::cin" and "std::endl". About a week or so of typing this and you will not even notice that you are doing it.
|
I would add to that someday you will create a variable or function using a name that you think is good, but turns out to also be in the standard name space. Then, when you compile the program, you will have a hard time with the error message which boils down to which are you trying to use the variable or function name that you created or the one in the standard name space which is different from what you want? Except for the name being the same?
The other possibility is, if you intend this to be a career, yours future employers are likely to tell you the line
using namespace std;
is not to be used in any of their programs. Now you will have to learn everything that is in the name space standard at one time when you should have been learning it slowly from the start.
I do not understand why schools feel that teaching you to use
using namespace std;
is a good thing. There are times that the "using" statement is useful and it is generally better to limit the scope of the "using" statement.
This is a link I give to people who thing that
using namespace std;
in a header file is OK, but actually that is worse:
http://www.lonecpluspluscoder.com/2012/09/22/i-dont-want-to-see-another-using-namespace-xxx-in-a-header-file-ever-again/ It does not really apply here, but worth reading.
Hope that helped more than confused you,
Andy