Time delay is time is used by program to execute next statement. Syntax of time delay on C programming language
is:
sleep(numbers_in_milisecond)
Contoh:
sleep(3000)
untuk jeda selama 3000 milisecond atau 3 detik.
Example we have program as follows
main()
{
int a,b,c;
printf("input first number: ");
scanf("%d", &a);
printf("input second number: ");
scanf("%d", &b);
printf("input third number: ");
scanf("%d", &c);
printf("\nNumbers are input sequentially are:");
printf("\n%d", a);
printf("\n%d", b);
printf("\n%d", c);
getch();
}
Try to run the program.
Example we give time delay at every instruction to show again integer inputted, so that program syntax becomes:
main()
{
int a,b,c;
printf("input first number: ");
scanf("%d", &a);
printf("input second number: ");
scanf("%d", &b);
printf("input third number: ");
scanf("%d", &c);
printf("\nNumbers are input sequentially are:");
sleep(1000);printf("\n%d", a);
sleep(1000);printf("\n%d", b);
sleep(1000);printf("\n%d", c);
getch();
}
Thank you... : )
sleep(numbers_in_milisecond)
Contoh:
sleep(3000)
untuk jeda selama 3000 milisecond atau 3 detik.
Example we have program as follows
main()
{
int a,b,c;
printf("input first number: ");
scanf("%d", &a);
printf("input second number: ");
scanf("%d", &b);
printf("input third number: ");
scanf("%d", &c);
printf("\nNumbers are input sequentially are:");
printf("\n%d", a);
printf("\n%d", b);
printf("\n%d", c);
getch();
}
Try to run the program.
Example we give time delay at every instruction to show again integer inputted, so that program syntax becomes:
main()
{
int a,b,c;
printf("input first number: ");
scanf("%d", &a);
printf("input second number: ");
scanf("%d", &b);
printf("input third number: ");
scanf("%d", &c);
printf("\nNumbers are input sequentially are:");
sleep(1000);printf("\n%d", a);
sleep(1000);printf("\n%d", b);
sleep(1000);printf("\n%d", c);
getch();
}
Thank you... : )
0 komentar:
Posting Komentar