First-program-in-C++ .

In this session i have discussed first program in C++ .


Lets see how to write the first program in C++

    #include<iostream.h>
    using namespace std;
    int main()
    {
        cout<<"Hello World";
        return 0;
    }
    
    OUTPUT : Hello World
    

#include<iostream.h>

#include<iostream.h> this line inform the compiler to include the header file before executing the program . It is also known as preprocessor .

main() function

main() function is a function which is must in every C++ program. Everything inside this function in a C++ program will be executed. In the above example, int written before the main() function is the return type of main() function . The curly braces { } just after the main() function encloses the body of main() function. We will learn what functions are in upcoming tutorials.

cout<<"Hello World"

The cout<<"Hello World" is used to print the any thing on the output screen . In my case it is print the Hello World .

Welcome to AndroidATPoint.

back image                     next image