
 |
![]() |
|
|
|
|
 |
The ‘Hello World’ Program
In case you are new to programming it is crucial that every programming language has to contain a hello world program. A hello world program is the first program that you will get your hands on when you first start programming in a certain language (in this case C++), it is a simple program that simple outputs the words hello and world. To make a long story short, it is just a way of familiarizing yourself with the program’s output command. In C++, the same basic principles apply, so open up your favorite compiler and get ready to code!
Now, lets review what you just did:
The function of this line is to include into your project the iostream.h header file which contains all of the standard input/output. Then you have int main(void). Main is the main function of the C++ program, without it your application would not have a starting point so it will do absolutely nothing. main is a function just like all of the other C++ functions, except it is a special function (the main entry to the program). It returns an int, more about that in following chapter. Void means absolutely noything!! It is an acronym of 0. From the starting curly-brackets to the ending ones ‘{}’, everything inside those brackets is local to the function main(). What cout does is it outputs << this way to the screen or wherever else your output maybe. Then the program returns a 0, exit code of (No Problem/SUCCESS). And that is all I have to say about the hello world program.Please Rate this Code:
Comments for: The ‘Hello World’ Program
MoMad [big_mo_mine@yahoo.com] Posted: 31 times. says:
C version of hello world goes something like this:
Note: The use of constant integers in the return is not such a good idea because every operating system uses a different exit code. So for portability resons, consider the following code:
 | |  | | |
#include <stdlib.h>
// this is the library that has all of
// the return codes defined.
// they are different on each operating system
int main(void)
{
// somethign goes here
return EXIT_SUCCESS;
}
// if an error occurs in your program, use:
// return EXIT_FAILURE;
|
|  |
|
That is all. |
 |
 |
MoMad [big_mo_mine@yahoo.com] Posted: 31 times. says:
C version of hello world goes something like this:
Note: The use of constant integers in the return is not such a good idea because every operating system uses a different exit code. So for portability resons, consider the following code:
 | |  | | |
#include <stdlib.h>
// this is the library that has all of
// the return codes defined.
// they are different on each operating system
int main(void)
{
// somethign goes here
return EXIT_SUCCESS;
}
// if an error occurs in your program, use:
// return EXIT_FAILURE;
|
|  |
|
That is all. says:
for borland turbo (that has been discontinued) this also works.
#include
int main(void)
{
printf(\"Hello world\");
return 0;
}
|
 |
 |
MoMad [big_mo_mine@yahoo.com] Posted: 31 times. says:
C version of hello world goes something like this:
Note: The use of constant integers in the return is not such a good idea because every operating system uses a different exit code. So for portability resons, consider the following code:
 | |  | | |
#include <stdlib.h>
// this is the library that has all of
// the return codes defined.
// they are different on each operating system
int main(void)
{
// somethign goes here
return EXIT_SUCCESS;
}
// if an error occurs in your program, use:
// return EXIT_FAILURE;
|
|  |
|
That is all. says:
for borland turbo (that has been discontinued) this also works.
#include
int main(void)
{
printf(\"Hello world\");
return 0;
}
says:
{
//somethign goes here
|
 |
 |
MoMad [big_mo_mine@yahoo.com] Posted: 31 times. says:
C version of hello world goes something like this:
Note: The use of constant integers in the return is not such a good idea because every operating system uses a different exit code. So for portability resons, consider the following code:
 | |  | | |
#include <stdlib.h>
// this is the library that has all of
// the return codes defined.
// they are different on each operating system
int main(void)
{
// somethign goes here
return EXIT_SUCCESS;
}
// if an error occurs in your program, use:
// return EXIT_FAILURE;
|
|  |
|
That is all. says:
for borland turbo (that has been discontinued) this also works.
#include
int main(void)
{
printf(\"Hello world\");
return 0;
}
says:
{
//somethign goes here
says:
for a correct c++ implementation go for...
 | |  | | |
#include <iostream>
using namespace std;
int main(){
cout << "Hello World";
return 0;
}
|
|  |
|
nice site though, keep up the good work ! |
 |
 |
|
 |
|
 |
|
|
|
|
|
|
|