fork download
  1. #include <iostream>
  2. #include <unistd.h>
  3. #include <sys/types.h>
  4. #include <sys/wait.h>
  5. using namespace std;
  6.  
  7. int main() {
  8. int i;
  9.  
  10. cout << "Hello" << endl;
  11.  
  12. for (i = 1; i < 3; i++)
  13. fork();
  14.  
  15. cout << "Over" << endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5264KB
stdin
Standard input is empty
stdout
Hello
Over
Over
Over