http://orwelldevcpp.blogspot.com
Tools -> Compiler Options
F11
.File -> New -> Source File
(or Ctrl+N
)File -> Save As..
(or Ctrl+Alt+S
).cpp
extension, such as example.cpp
.F11
should compile and run the program.x
, the compiler does not understand the new meaning given to auto
since C++11. Please, make sure you downloaded the latest version as linked above, and that you enabled the compiler options to compile C++11 as described above.#include <iostream>
is a header file library that lets us work with input and output objects, such as cout
(used in line 5). Header files add functionality to C++ programs.using namespace std
means that we can use names for objects and variables from the standard library.#include <iostream>
and using namespace std
works. Just think of it as something that (almost) always appears in your program.int main()
. This is called a function. Any code inside its curly brackets {}
will be executed. cout
(pronounced 'see-out') is an object used together with the insertion operator (<<
) to output/print text. In our example it will output 'Hello World'.;
.int main()
could also been written as:int main () { cout << 'Hello World! '; return 0; }
return 0
ends the main function.}
to actually end the main function.using namespace std
line can be omitted and replaced with the std
keyword, followed by the ::
operator for some objects: