Language/C & C Plus
[C] 몇초간 정지 시키기
몰라욧
2012. 7. 13. 14:44
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void sleep(int nbr_seconds);
void main() {
int x;
int wait=13;
printf("\\Delay for %d seconds\n",wait);
printf(">");
for(x=1;x<=wait;x++) {
printf("aaaaaaaaaaaaa");
fflush(stdout); //퍼버가 있는 기계가 도트를 출력하도록 한다
sleep((int)1);
}
printf("Done!\n");
}
void sleep(int nbr_seconds) {
clock_t goal;
goal = (nbr_seconds*CLOCKS_PER_SEC) + clock();
while(goal>clock()){;}
}