What is the difference between these two?

I have just begun learning c++ and what i have learned online and what i have learned from a book are two different ways to get the same ending product. What exactly is the difference between the two? Since the output is the same is it just preference?

std::cout <<" Hello World " << std::endl;

and

cout << " Hello World " << endl;
its more than preference, std:: is a namespace so that functions and classes with the same name don't conflict, the second method is the worst one.
Last edited on
what he said BUT if your just beginning i would use
using namespace std;
because it is simpler, do this until you learn about namespaces an about using the std::
so the second is simplicity, and the first one is for more specific functions that are used by more experienced people.
nicely explained
I deleted it to avoid confusing the OP.
Thanks for the help you were all helpful!
Topic archived. No new replies allowed.