how to compile a c++ program in terminal code example
Example 1: how to compile and run cpp code in terminal
# compile cpp_code.cpp
g++ cpp_code.cpp
# run compiled file
./a.out
Example 2: terminal compile c++
g++ -o file file.cpp //or file.c
# compile cpp_code.cpp
g++ cpp_code.cpp
# run compiled file
./a.out
g++ -o file file.cpp //or file.c