Thursday 16 August 2012

C PROGRAM

 C PROGRAM FOR CREATING A SIMPLE CLOCK

This is a simple program which will show you the current time and the clock will keep ticking.

It actually picks the time from the system clock and then display it on the console.

 

Here is the code of the your home made clock.



 

#include<stdio.h>
#include<conio.h>
#include<dos.h>
int main()
{
struct time t;
clrscr();
while(1)
{
printf("\n\t\t\t\t============\n\t\t\t\t=\t   =\n\t\t\t\t= MY CLOCK =");
printf("\n\t\t\t\t=\t   =\n\t\t\t\t============");
gettime(&t);
printf("\n\n\n\n\t\t\t\t  ");
printf("%d:%d:%d",t.ti_hour,t.ti_min,t.ti_sec);
sleep(1);
clrscr();
}
return 0;
}

No comments:

Post a Comment