C++ First Program
Let's write a simple basic program structure of C++, its compilation and its execution (how it runs). This program is compiled using GCC compiler.
Open any editor to write C++ program.
#include<iostream>
using namespace std;
int main(){
cout<<"Welcome to C++ program"<<endl;
}
Output of above program
Welcome to C++ program
Compile and Run
After writing C++ program, save the program with any name (first) with .cpp extension (first.cpp).
Open any command prompt (MinGW Command Prompt) window and go to directory structure where C++ program file is saved.

After that write a command to run the program with command a (generated .exe file name).

To run this generated .exe file simply type command first or first.exe.


Let's understand the above code structure.
#include refers a preprocessor directive used to include header file, other files etc. before compiling the program.
<iostream> is header file contains the input stream, output stream functions.
using namespace std is used for using namespace std, where features of string or vector, are declared.
main() is the function from where the program main execution starts and int is the return type of function main(), int returns integer value.
cout<< is output stream use to display data on the screen. Its working functionality is provided in <iostream> header file.