+ Reply to Thread
Results 1 to 7 of 7

Thread: C/C++ Hello World Tutorial

  1. #1
    Khaotic is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Brandon, Mississippi, United States
    Posts
    62
    Rep Power
    12

    C/C++ Hello World Tutorial

    This tutorial I aimed for those who would like to learn to do basic output in c and in c++. This is very easy and for begginers, fun.

    Let's get down to business:

    C Version:
    Code:
    #include <stdio.h>
    
    int main() {
         printf("Hello World");
         system("PAUSE");
         return 0;
    }
    Explanation:
    #include <stdio.h> - This piece of code basically means that you want to include the Standard Input and Output header file. Header files are to be included in pretty much all your code seeing as this is where the "actual" code is.

    int main() { - This opens a function called main that returns and integer. All applications much have a main function.

    printf("Hello World"); - This prints to the screen "Hello World"

    system("PAUSE"); - Basically stops the application from closing seeing as it has already ran the code we wanted it to run. Another way of doing so is: getchar().

    return 0; - This is returned stating the application ran with no problems.

    } - Closes the main function.


    C++ Version:
    Code:
    #include <iostream>
    
    int main() {
         cout << "Hello World";
         system("PAUSE");
         return 0;
    }
    Explanation:
    #include <iostream> - This piece of code basically means that you want to include the Input and Output Stream header file. C++ header files do not need the .h extention. Header files are to be included into almost, if not, all applications, seeing as they hold the "real code".

    int main() { - This opens a function called main that returns and integer. All applications much have a main function.

    cout << "Hello World"; - This prints to the screen "Hello World"

    system("PAUSE"); - Basically stops the application from closing seeing as it has already ran the code we wanted it to run. Another way of doing so is: getchar().

    return 0; - This is returned stating the application ran with no problems.

    } - Closes the main function.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: C/C++ Hello World Tutorial

    Very nicely done! +rep.

  4. #3
    michaelvd12's Avatar
    michaelvd12 is offline Learning Programmer
    Join Date
    Apr 2009
    Posts
    99
    Rep Power
    11

    Re: C/C++ Hello World Tutorial

    grmph ,

    why you must do the same as me ?

    and about system("PAUSE"); , case matters !

  5. #4
    Khaotic is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Brandon, Mississippi, United States
    Posts
    62
    Rep Power
    12

    Re: C/C++ Hello World Tutorial

    I know this. My bad, didn't mean to not case it.

  6. #5
    Join Date
    Oct 2008
    Location
    Istog, Kosova
    Posts
    4,001
    Blog Entries
    1
    Rep Power
    40

    Re: C/C++ Hello World Tutorial

    +rep mate
    Interested in participating in community events?
    Want to harness your programming skill and turn it into absolute prowess?
    Come join our programming events!

  7. #6
    Khaotic is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Brandon, Mississippi, United States
    Posts
    62
    Rep Power
    12

    Re: C/C++ Hello World Tutorial

    Thanks mate. Means a lot to me.

  8. #7
    Zizooooo is offline Newbie
    Join Date
    Jul 2009
    Posts
    14
    Rep Power
    0

    Re: C/C++ Hello World Tutorial

    I am a beginner in learning C and ur explanation is so easy & so simple

    thank u very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 01-14-2011, 12:59 PM
  2. Visual Studio 2008: C# Hello World Tutorial
    By Jordan in forum CSharp Tutorials
    Replies: 32
    Last Post: 07-30-2010, 07:15 AM
  3. [D] Hello World Tutorial
    By Termana in forum Tutorials
    Replies: 6
    Last Post: 01-09-2009, 03:10 PM
  4. Java:Tutorial - "Hello World"
    By John in forum Java Tutorials
    Replies: 20
    Last Post: 12-23-2008, 06:52 PM
  5. Tutorial: C# Hello World
    By Jordan in forum CSharp Tutorials
    Replies: 15
    Last Post: 10-16-2008, 08:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts