Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- It is a Clock! Set the initial parameters: hours (h), minutes (m) and seconds (s).
- */
- #include <stdio.h>
- #include <windows.h>
- #include <conio.h>
- int main(){
- int h, m, s;
- printf("Enter h, m, s: ");
- scanf("%d %d %d", &h, &m, &s);
- while(!kbhit()){
- system("cls");
- printf("elapsed time (h:m:s): %2d : %2d : %2d\n", h, m, s++);
- Sleep(1000);
- if(s == 60){
- s = 0;
- m++;
- }
- if(m == 60){
- m = 0;
- h++;
- }
- }
- printf("\nEnd!\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement