C++ is one of the most versatile languages in the world. It is used nearly everywhere for everything… systems programming (operating systems, device drivers, database engines, embedded, Internet of Things, etc.)

Enter Header Image Headline Here

Friday 7 April 2017

C++ First Program

                                  C++ First Program


Sample C++ Program 


/* 
This is a simple C++ program. 
Call this file Sample.cpp. 
*/  
 
#include <iostream>
using namespace std;  
 
// A C++ program begins at main(). 
int main()
{
cout << "C++ is power programming.";
return 0;
}

Output  : 


C++ is power programming.

Explanation: First C++ Program :

Consider the following line in the programs –
/* 
This is a simple C++ program. 
Call this file Sample.cpp. 
*/



 
1.     It is Comment in C++ Language which is ignored by compiler

  2.     Comments are written for user understanding.

#include <iostream>



  3.    
C++ uses different header files like C.

  4.   Include statement tells the compiler to include Standard Input Output Stream inside 
        C++ program.

  5.   This header is provided to the user along with the compiler.

int main()



  6.    Each C++ program starts with the main function like C Programming.

  7.    The return type of the C++ main function is an integer, whenever the main function returns 0 value
          to operating the system then program termination can be considered as smooth or 
        proper.

  8.   Whenever some error or exception occurs in the program than the main function 
        will return the non- zero value to the operating system.
cout << "C++ is power programming.";


   9.   C++ Insertion operator (<<) is used to display value to the user on the console 
         screen.

return 0;


  10.   Return statement sends the status report to the operating system about program 
            execution whether program execution is proper or illegal.





0 comments:

Post a Comment

Popular Posts

Recent Posts

Categories

Unordered List

Text Widget