#include #include using namespace std; const int range = 100; int main() { int myID {0}; int i{1}; while (i < 10 and myID == 0) { //while (i < 10 ) { cout << "Process " << myID << " about to fork " << endl; pid_t newPid{fork()}; if (newPid == 0) { //myID = i+myID * 10; myID = i; } ++i; } //usleep(10000000); cout << myID << " (" << getpid() << ")" << " will compute from " << myID * range << " to " << myID*range+ range-1 << endl; return 0; }