Brothersoft.comWindows|Mac|Mobile|Games

|Message

Solve software problem quickly Share experience to help others Improve the ability of solving problem
How to Write the Hello World Program in CPP?

08/24/2011 08:52 by wawaslope

First answer posted by Bentley907 at 08/24/2011 08:52
Add Your Answer
10~1000 characters in length CAPTCHA:
21 Answers
  • Bentley907
    1. Get a CPP compiler. If you're using Windows OS, I'd suggest you to get the latest Microsoft Visual CPP. If you're running a linux distribution or Mac OS, get Code::Blocks or Bloodshed Dev CPP. You can obviously get them on windows too and use whichever you feel most comfortable with.
    2. Open a new project file, and choose "console application" on your compiler. This means your "Hello World!" application would be running on the console and not your operating system.
    3. If your compiler is a Microsoft Visual CPP, then first enter the following on the first line - #Insert "stdafx.h". Ignore this step if your compiler is not a Microsoft Visual CPP.
    4. On the next line (if you've entered the previous statement, otherwise this would be the first line), enter #include . This statement declares that the terms we are going to use to write the program are included in the CPP library known as "iostream".
    5. Go to the next line to enter your function, the set of instructions that defines the structure of your program and tells the compiler what to do, in this case to display the message "Hello World!" from your console. Type "int main ()" .
    6. Go to the next line and use a flower bracket "{", to mark the beginning of this main () function.
    7. On the next line, you have to write statements, the group of which is the function. First statement in this program is - using namespace std;.
    8. Each statements inside a function ends with a semi-colon ";". The last statement ends with "endl" and semi-colon. Now go to the next line and type cout
    9. Go to the next line and declare the return value of this function - return 0;
    10. Go to the next line and use the ending flower bracket "}" to denote the end of your main function. While complicated programs would include numerous functions, this is the simplest program possible and your first program ever so it just contains the main function.
    11. Press "F7" or click on the compile icon or option from the drop down menu to compile your program.
    12. Press "CTRL" and "F5" together to run your program.
  • Was this answer helpful? 10 · 08/24/2011 08:52
  • Anonymous user
  • #include<stdio.h>

    main()

    {

    clrscr();

    printf("Hello World");

    getch();

    }

  • Was this answer helpful? 20 · 11/27/2011 06:29
  • Anonymous user
  • #include<conio.h>

    #include<iostream.h>

    void main()

    cout<<"Hello World";

    getch();

    }

  • Was this answer helpful? 10 · 08/31/2011 13:14
  • Anonymous user
  • #include<conio.h>

    #include<iostream.h>

    void main()

    cout<<"Hello World";

    getch();

    }

  • Was this answer helpful? 10 · 10/14/2011 19:54
  • Anonymous user
  • #include<stdio.h>

    int main()

    {

    printf("Hello World\n");

    returnf 0;

    }

  • Was this answer helpful? 10 · 11/25/2011 16:34
  • Anonymous user
  • # include<iostream>

    using namespace std;

    int main()

    {

    cout<<"hello world"<<endl;

    return o;

    }

  • Was this answer helpful? 10 · 12/08/2011 09:19
  • Anonymous user
    • #include<conio.h>

      #include<iostream.h>

      void main()

      cout<<"Hello World";

      getch();

      }

  • Was this answer helpful? 00 · 10/28/2011 09:01
  • Anonymous user
  • i#include <stdio.h>

    main()

    {

             printf(Hello World!!!");

             

     

    getche();

    }

  • Was this answer helpful? 01 · 11/14/2011 07:00
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    main ()

    {

    clrscr

    printf("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 01/03/2012 18:45
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    clrscr();

    printf("hello world");

    getch();

    }

  • Was this answer helpful? 00 · 01/10/2012 14:47
  • Anonymous user
  • #include<stdio.h>

    main()

    {

    printf("hello world");

    }

  • Was this answer helpful? 00 · 02/22/2012 16:37
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    main ()

    {

    clrscr

    printf("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 03/19/2012 17:27
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    main ()

    {

    clrscr

    printf("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 03/19/2012 17:27
  • Anonymous user
  • main()

    {

    scanf("%d/n");

    printf("hello");

    }

  • Was this answer helpful? 00 · 03/23/2012 13:39
  • Anonymous user
  • #include<stdio.h>

    main()

    {

    print("hello world");

    getch();

    }

  • Was this answer helpful? 00 · 06/27/2012 05:13
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    print("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 08/16/2012 09:09
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    print("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 08/16/2012 09:09
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    print("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 08/16/2012 09:09
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    print("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 08/16/2012 09:09
  • Anonymous user
  • #include<stdio.h>

    #include<conio.h>

    void main()

    {

    print("hello world"\n);

    getch();

    }

  • Was this answer helpful? 00 · 08/16/2012 09:10
  • Tanweer alam
    • /* outputhello world*/

    • #include<stdio.h>

      #include<conio.h>

      void main()

      {

      print("hello world"\n);

      getch();

      }

  • Was this answer helpful? 00 · 01/13/2013 15:29
Add Your Answer
10~1000 characters in length CAPTCHA:

Added Successfully!

×

Are you sure to delete your answer?

NoYes

×

Are you sure to choose it as the best answer?

NoYes

×

Voted Successfully!

×

You can't vote for yourself

×

You can't choose your own answer

×