Originally posted here by Lansing_Banda
So pwarning, if you don't use namespace std, then what do you do, define everything before your programs?
Instead of writing:

Code:
using namespace std

cout << "Like this\n";
I use:

Code:
std::cout << "Like this instead" << std::endl;
In other words, every time I use cout, I write it in full including the namespace - i.e. std::cout. Same for std::endl, std::cin etc.

Originally posted here by White_Eskimo


I bet he does what any half-smart programmer would do which is put all of the using std directives into a header file and then before he writes his programs, he just types in #include "directives.h" and viola he has everything he wanted (if you read my tutorial about the preprocessor you would know how to do this )
Nope, never used that - although it would be the most sensible way to go about it if I was going to skip the namespaces. The thing is, I'm not anti-using namespace because it requires extra lines etc., but because it defies the whole point of having namespaces in the first place. I use std::cout all the time and it always compiles and works as I expect.

Originally posted here by White_Eskimo

Yup pwarning you are right there...also you could do something by calling the flush() function in the iostream library that will flush the buffer for you...an example of this in code would look something like this:

Anyways, the only problem about using the flush() function that is built in to your iostream library is that it doesnt skip a line like endl does
Of course, there's nothing stopping you from flushing the output explicitly using the flush() function - if that's all you want to do. However, if you're going to add a newline anyway, you might as well use std::endl. It's a matter of using the best tool for the job at hand.