EOSERV Wiki > Page: C plus plus Guide Hello World > History > View Revision

View Revision: C plus plus Guide Hello World

C++ Tutorial("Hello World")

Why hello everyone I'm just going to cut the crap and start the guide.

Well today I am going to show you how to get Codeblocks and make your first console Application.//

The first step is installing Codeblocks: HERE

Installing it just do: Next->I Agree->Next->Install and allow it to Install

One it is done installing it's time to launch Codeblocks... So launch it :p

-Once you launch it goto File->New->File...

-Choose C/C++ Source and click Next until you get to naming it.

-Click on the "..." button and name the file main.cpp and save it to your Desktop.

-It should then open up main.cpp now time for the coding part xD.

Programming Section(explanation):

#include <iostream>
- The "#include" part of the line is including the library "<iostream>". The "<iostream>" part is a header file which is used for input/output in the C++ programming language.

using namespace std;
- keeps you from having to type std::cout each time you want to display a output on the console it always ends with a ";".

int main()
- his line corresponds to the beginning of the definition of the main function. The main function is the point by where all C++ programs start their execution.

{
- Starting bracket for the main code.

cout << "Hello World";
- 'cout << "" ' takes the text which is contained in the ""and outputs it on the console screen. it end's with a ";".

return 0;
- The "return" statement causes the main function to finish. return may be followed by a return code.It is followed by the return code with a value of zero.

}
- The end bracket finishes the main code.

Full Code for Newbs:

#include <iostream>
        using namespace std;

              int main ()
             {
                cout << "Hello World!";
                return 0;
              }

Then just Build&Run it.

EOSERV Wiki > Page: C plus plus Guide Hello World > History > View Revision