Problem scenario
You want to see how C++ works. You want to read in user input from the keyboard and have the C++ program run a bash command. How do you do this?
Solution
Compile this code (e.g., as a file named “test.cpp” with “g++ test.cpp”) and run it (e.g., ./a.out):
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main ()
{
…