g++ how to compile c++ code example
Example 1: compile c++ program
$ g++ -o <name-you-want-to-give> source.cpp
$ ./myprogram
Example 2: compile in c++
$ g++ -o <name-you-want-to-give> source.cpp
$ g++ -o <name-you-want-to-give> source.cpp
$ ./myprogram
$ g++ -o <name-you-want-to-give> source.cpp