using namespace std can be okay in trivial example code, but it really should be avoided in proper code. In particular it should never appear in the global scope of a header file as that 'contaminates' the global namespace of any code that includes it. It can be the cause of some rather subtle and hard to find errors.