Sample C++ Program : First C++ 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.

Dissecting First C++ Program

/* 
This is a simple C++ program. 
Call this file Sample.cpp. 
*/
  • This is Comment in C++ Language.
  • Comment is ignored by Compiler.
  • Comment are written for user understanding.
#include <iostream>
  • C++ uses different header files like C.
  • Include statement tells compiler to include Standard Input Output Stream inside C++ program.
  • This header is provided to user along with the compiler.