Here\'s my code:
#include
#include
#include
#include
#include
#
Jonathan has the right idea. You rely on the first process to fork all the others. Each one has to run to completion before the next one is forked.
Instead, fork the processes in a loop like you are doing, but wait for them outside the inner loop, (at the bottom of the big loop for the shell prompt).
loop //for prompt
next prompt
loop //to fork tasks, store the pids
if pid == 0 run command
else store the pid
end loop
loop // on pids
wait
end loop
end loop