Advertisement

How to Print Hello World !


The "Hello world ! " program is the first step towards the C++ programming and also one of the simplest program in C++.

If u want to print "Hello world" in the screen so look at this .

// Header file for input output functions 
#include<iostream>  
using namespace std;   
// main function - 
// where the execution of program begins 
int main(){
// prints hello world 
   cout<<"Hello World !"
    return 0

Output:

      Hello World ! 

         Now let's understand the logic of given above program.

  •  // "C++ comments to Display hello world";  This is a comment line .  this line shows that the additional information the program . A comment does not contain any programming logic.
  •  #include :  In the c++ all the lines started with pounds (#) . are called directive and processed by processor which is a program invoked by the compiler . The #include directive tell the compiler include a file #include<iostream>
  •  Using namespace std : This define a scope for the identifier that are used in a program for being the identifier define in the namespace scope we must include the using directive .
  •  int main () :   In C++ main() return a integer type value to the operating system . Therefore , every main() in C++ should end with a return (0) statement , otherwise a warning or an error might occur . since mains() a integer type value , return type for main() specified as int .  
  • { And } : This indicate the braces { it indicate the beginning of the main function and ending of the function }.
  •  Return 0 :  This is also a function this statement also return a value of the function and indicting the ending of the function.



   This is my YouTube channel : Click Here

    Playlist of C++(Full Course) : Click Here

    Playlist of C++(Program ) : Click Here


 Please ! write comment if you find anything incorrect in this website .

 This article is contributed by Mohd abuzar . If you want to like code with abuzar or want to contribute with us so mail at - abuzar.abuzar.mohd325@gmail.com





Post a Comment

0 Comments