Type this program and figure out what it is doing.
// Steve Dannelly // CSCI 208 Lab #14 #include <iostream> using namespace std; int main () { int value; // a variable for both processes // get something to remember cout << "Enter an integer: "; cin >> value; // create a clone fork(); // output some information cout << "I am process " << getpid(); cout << ", my parent is " << getppid(); cout << ", and you entered the number " << value << endl; }
Modify the program so that only the child prints the output message. In other words, put an if statement after the fork(); that the child will find true and the parent will find false.
Turn in a printout of your modified program in one week.