cout<<"Main Process with pid : "<<getpid();
cout<<"\nSplit starts : ";
cout<<"\nChild Process with pid :"<<getpid();
cout<<"\nParent Process with pid :"<<getpid();
I think Win32 does provide _getpid(), although GetCurrentProcessId is a better option.
The bigger issue here is the *nix and Windows handle creating new threads/processes in different philosophical ways, and simply taking a Unix way and translating it directly to Windows functions isn't the best option. You'd be better off learning the Win32 way of creating new processes/threads.