/////////////////////////////////////////////////// // Example Fork program: Each created process laughs. // Every fork = parent creates another child process, identical to parent. // cout = print; endl = endline; << = concatenate /////////////////////////////////////////////////// // To compile at unix command line: g++ lab1.cpp -o lab1 // To run: ./lab1 /////////////////////////////////////////////////// #include #include using namespace std; int main() { // parent creates a child process, both laugh Ha! fork(); cout << "Ha! " << endl; // parent creates a child process, both laugh Ho! fork(); cout << "Ho! " << endl; // parent creates a child process, both laugh He! fork(); cout << "He! " << endl; }