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;
}
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.
Write a command to compile C++ program using command g++ first.cpp (g++ file_name.cpp). This command generates an executable file with default name a at same directory.
After that write a command to run the program with command a (generated .exe file name).

If we want to generate executable (.exe) file with different name, write a command g++ first.cpp –o first. This generates an executable file of name first.
To run this generated .exe file simply type command first or first.exe.

