Add to Favorites    Make Home Page 27185 Online  
 Language Categories  
 Our Services  

Home » C Home » Multimedia and Sound Home » CLOCK PROGRAM

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title CLOCK PROGRAM
Author K SAI RAM TILAK
Author Email tilak1984 [at] yahoo.com
Description This is clock program which resembles a wall clock. There are two versions of the program, one directly displays the clock and the
other has a little graphical introduction.
This clock program takes the time from the system when it is executed and from then it ticks for each second until any key is hit.
Category C » Multimedia and Sound
Hits 20155
Code Select and Copy the Code
Code : #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<graphics.h> #include<dos.h> #include<math.h> void main() { struct time t; void drawclock(void); void intro(void); void sound(void); int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"D:\tc\bgi"); int i,j,k,s,m,h; intro(); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); drawclock(); gettime(&t); if(t.ti_sec>15) s=360-((t.ti_sec-15)*6); else s=90-(t.ti_sec*6); if(t.ti_min>15) m=360-((t.ti_min-15)*6); else m=90-(t.ti_min*6); if( (t.ti_hour==0)||(t.ti_hour==1)||(t.ti_hour==2)||(t.ti_hour==3)) h=90-(t.ti_hour*30)-((t.ti_min/12)*6); else if((t.ti_hour>=4)&&(t.ti_hour<=12)) h=360-((t.ti_hour-3)*30)-((t.ti_min/12)*6); else if((t.ti_hour>=13)&&(t.ti_hour<=23)) h=360-((t.ti_hour-15)*30)-((t.ti_min/12)*6); else// if(t.ti_hour==12) h=90-((t.ti_hour-12)*30)-((t.ti_min/12)*6); for(k=0;k<=12;k++) { if(h==0) h=360; delay(1000); drawclock(); for(j=0;j<=60;j++) { if(m==0) m=360; setcolor(4); sector(320,150,m,m+1,75,75); m=m-6; delay(1000); drawclock(); for(i=0;i<=60;i++) { setcolor(4); sector(320,150,h,h+3,60,60); setcolor(4); sector(320,150,m,m+1,75,75); if(s==0) s=360; setcolor(1); sector(320,150,s,s+1,80,80); sound(); s=s-6; delay(1000); drawclock(); if(kbhit()) exit(0); } setcolor(6); sector(320,150,h,h+3,60,60); } } getch(); } void drawclock() { cleardevice(); setbkcolor(15); setcolor(1); circle(320,150,80); setcolor(5); circle(320,150,95); circle(320,150,1); outtextxy(314,58,"12"); outtextxy(268,70,"11"); outtextxy(235,105,"10"); outtextxy(233,147,"9"); outtextxy(241,190,"8"); outtextxy(273,225,"7"); outtextxy(318,238,"6"); outtextxy(362,225,"5"); outtextxy(392,190,"4"); outtextxy(403,147,"3"); outtextxy(393,105,"2"); outtextxy(361,70,"1"); outtextxy(302,200,"TILAK"); } void intro() { int i; int u=installuserfont("TSCR.CHR"); settextstyle(u,0,7); outtextxy(175,100,"TILAK's"); outtextxy(250,200,"CLOCK"); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading.."); for(i=0;i<510;i++) { setcolor(15); rectangle(50,100,50+i,110); delay(5); } settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading...."); for( i=0;i<510;i++) { setcolor(4); rectangle(50,100,50+i,110); delay(5); } settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading......"); for(i=0;i<510;i++) { setcolor(15); rectangle(50,200,50+i,210); delay(5); } settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading........"); setfillstyle(SOLID_FILL,1); fillellipse(320,205,6,6); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading.........."); for(i=0;i<510;i++) { setcolor(15); rectangle(50,300,50+i,310); delay(5); } settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading............"); for( i=0;i<510;i++) { setcolor(2); rectangle(50,300,50+i,310); delay(5); } settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1); outtextxy(380,400,"Loading.............."); delay(1000); } void sound() { sound(2000); delay(100); nosound(); }

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi դ ? ??
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions
Copyright ©2003-2019 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=995


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review