I'm reading Accelerated C++ and on their first example they have the code:
Code:
// a small C++ program
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
When it starts the cmd closes and won't display Hello, World!
However from another book I was taught to do it like this:
Code:
// a small C++ program
#include <iostream>
useing namespace std; // (I use this)
int main()
{
cout << "Hello, world!\n"; // Instead of std::cout << just cout and I use \n for next line.
return 0;
}
This code works fine, why is std::cout taught then?