Per il Ritardo c'e' la funzione (del Dos)
int time = 1000;
sleep(time);