how to run a c++ program from 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: run cmd command c++
#include <iostream>
using namespace std;
int main() {
system("DATE");
return 0;
}