for using cout
, I need to specify both:
#include
and
using namespace std;
The #include
references the header file that defines cout. If you're going to use cout, then you will always need the include.
You do not need to using namespace std;
. That's simply allows you to use the shorthand cout
and endl
and the like, rather than std::cout
and std::endl
where the namespace is explicit. Personally I prefer not to use using namespace ...
since it requires me to be explicit in my meaning, though it is admittedly more verbose.