They are the same. cout is in the std:: namespace. The definition is something like this:
1 2 3 4
namespace std
{
ostream cout;
}
To access an object in the std namespace, you can prepend std:: to the variable, or you can use the using keyword like: usingnamespace std; or using std::cout;.
I prefer prepending std:: to my variables when they aren't used often. If I use them all of the time, then I like using std::cout;. I don't use: usingnamespace std; because std is huge and it brings in many functions that I don't need. It causes the potential for naming conflicts.
For example, if I make a function called sort, when I add using namespace std; I have a problem in that it might try and call std::sort instead of my own version.
a language purist would say you shouldn't employ either version of 'using' and that you should always prefix each and every element from a namespace with its identifier. In my opinion, that's like calling your best friend by hist first and last name all the time. It just seems a little too formal.
if you hate typing, you can employ the 'using' directive. A decent compromise is to employ 'using' declarations.
The really hardcore purist would write ::std::cout in case someone creates their own namespace called "std", nested within another user-defined namespace, and sneaks in a using directive