I'm reading Accelerated C++ and on their first example they have the code:
When it starts the cmd closes and won't display Hello, World!Code:// a small C++ program #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; }
However from another book I was taught to do it like this:
This code works fine, why is std::cout taught then?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; }



LinkBack URL
About LinkBacks



I must say learning C++ has been a lot of fun with the book I'm reading! Even though I'm an expert in VB, when I learn C++ I most likely will never use VB again.