Because you are not waiting for all threads to finish. The simplest and crudest method is to create 10 threads and save them all, and then have a loop to join them one by one, and finally detach.
If you can use the Windows API, use this (https://msdn.microsoft.com/en-us/library/windows/desktop/ms687028(v=vs.85).aspx).
Because you are not waiting for all threads to finish. The simplest and crudest method is to create 10 threads and save them all, and then have a loop to join them one by one, and finally detach.
If you can use the Windows API, use this (https://msdn.microsoft.com/en-us/library/windows/desktop/ms687028(v=vs.85).aspx).
The program just closed when 5 were printed out