Normal C++ VS C++11

I program apps for windows but recently I've started developing for Mac OS X Mountain Lion using Xcode 4.4. But for some reason, it won't accept the most simple C++ app, Hello World!

Here's the code it gave me:

#include <iostream>

int main(int argc, const char * argv[])

// insert code here...
std::cout << "Hello, World!\n";
return 0;

Heres the code I wrote:

#include <iostream>

int main()
cout << "Hello, World!\n";
system ("pause");
return 0;

You need to include cstdlib header to use system() function.

However, it is not recommended to use it at all, anywoy sytem("pause") only do what you think in windows environment.
Also you need to write using namespace std; in order to use cout.
PS: What does this have to do with C++ vs C++11?
Last edited on
Sorry, I did writeusing namespace std; but forgot to mention it. When I was downloading Xcode in the description it said something like
Supports C++11.
Could you also just highlight some difference between C++ and C++11?
Last edited on
There isn't a "difference" in that sense, there aren't any pos and cons, it's more like "What's the difference between C and C++?" There is no both-derectional "difference", C++11 is a superset of C++03 and 98. Look at this:
C++ is the language. C++11 is the name for the latest version of C++, so C++11 is still C++. Older versions are C++98 and C++03.
Is there any differences in the code? Or maybe does it add new libraries etc?
Yes, it add new libraries and language features. However, you should not be your concern, as you are a beginner, so likely you don't use them anyway.
There are differences in the code ONLY if you want them! Very little stuff is removed, mostly added. Sure, now there are easyer ways to do some stuf, but everything that worked before, works now.
Topic archived. No new replies allowed.