Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[TUT] How to C++ Code: FOR BEGINNER'S [TUT]

Not open for further replies.
duck You
Loyal Member
Jun 27, 2007
Reaction score
First things first. To start programming you will need to get you a Compiler. There are several free as well as a few Commercial ones. Unless you have a few hundred dollars to buy the Commercial Compilers I suggest you get you a free compiler.

Here is a list of a few free compilers for Windows:
  • <LI itxtvisited="1"> (IDE: uses MinGW or Cygwin) <LI itxtvisited="1"> (Command Line)
  • (I think it's Command Line)
and Unix come with a C/C++ compiler(I think). Just make sure you installed it and read the manuals!

Okay. You'll need to download one of those compilers and read the manuals on them. I use Dev-C++. If you have some questions using that specific compiler I might be able to help.

Let's get on with the code Shall we?

Windows users: Open up Notepad.
Dev-C++ : Just open it up and click on the new file icon.
*nix: Open up your favorite Text Editor. :)

1: #include <iostream.h>
3: int main()
4: {
5: cout << "Hello World!" << endl;
6: return 0;
7: }

Go ahead and copy that little piece of code. (Starting with #include and ending with the last } ) You can paste it or just type it up in the text editor. Save it as hello.cpp . The .cpp extention lets the compiler know it's a C++ Source File. To compile in Dev-C++ click on the compile icon or Execute->Compile.
Note: The Remove the numbers. They are there only to help analyze the code!
You will have to read the instructions on how to compile it in Compilers other than Dev-C++.

Congratulations! You are now a C++ Programmer!

On Windows Machines the application will close very quickly if you run it. THAT IS OKAY! We will learn how to fix that later.. The point is you got the program to compile! Now let's break down the code.

#include <iostream.h>

The first symbol is the pound symbol. It is a symbol to the . (Any words that are links will link to another tutorial with definitions in it. For now it DOES NOT EXIST)
After that is the word include. Together #include tells the compiler to include a file into your program. It is just as you had written it in there yourself!
Iostream.h is called a and is included our program. Why? Iostream stands for Input-Output-stream and is needed for , which prints things to the screen. iostream.h is surrounded by a < and a >. This tells the compiler to search in the 'include' directory for the file. iostream.h can also be surrounded by Quotations like so: "iostream.h"
This tells the compiler to look in the current directory for the file. iostream.h is obviously not in your current directory so leave the greater than and less than sign there!

Line 2 is just a blank line. It's just there as a part of .

Line 3 is the beginning of the Actual Program. On it is the main() . Every C++ program has a main() program. When your program starts it automatically calls main(). According to ANSI Standard we must state main() to be . This will be discussed in another tutorial.

Line 4 begins the body of the main() function. All functions begin with an Opening brace ( { ) and a closing brace ( } ) just as main() does. Everything inbetween is considered to be a part of the function.

Line 5 is what the program is all about! The object cout is used to a message to the screen. This is how cout is used:
You write cout followed by the output redirection operator ( << ). The operator is created by hitting shift-comma twice. Everything after the < is printed to the screen. (Or atleast tried to.) until it reaches a semi-colon. ;
endl is way to make the string go to a new line. You also put a \n in the string instead of using endl like this:

cout << "Hello World\n";

If you want a string of characters to be written to the screen you put your text between two Quotations: "Hello world!" like so! You then put a semi-colon at the end signifying the end of the statement. Semi-Colons are somewhat like an English period. It tells the compiler that a statement is over. You'll learn where to put them and where not to put them as we get further into the tutorials.

Line 6 is a return statement. It returns 0 to close the program. It also ends in a semi-colon. This will be discussed in more detail in a later tutorial!

Line 7 is just a closing brace and the end of our program. The closing brace is required to 'close' the function! That's the 'hello world' program fully explained. You can experiment with outputting text by simply making a couple more cout statements.

If anything is to complicated to understand or if I screwed up. >:) then be sure to let me know. Please let me know if you would like anything more, want something explained in a little more detail or whatever. I'll try my best to fix it!

Thank's alot for reading this TUT. If you'd like me to make different TUT's for like, advanced or w/e, Just let me know. :]
Junior Spellweaver
Aug 25, 2007
Reaction score
It is a good tut but this is " Habbo Tutorial -Section " not a coder section ,

It would be nice if you post maybe C++ For HoloEMU , Maybe its better because this does not relate to Habbo or have anything about habbo . I would recommend that you do a ( C++ ) Tutorial about maybe HoloEMU or Jase . It would help everyone and including me as i don't even know what the hell is that .

Please post this to " Coder Paradise " Zone or anything else xD
Dec 1, 2007
Reaction score
Copied from this guy
Retro! - [TUT] How to C++ Code: FOR BEGINNER'S [TUT] - RaGEZONE Forums

Not open for further replies.