├── Clock in c program.C └── README.md /Clock in c program.C: -------------------------------------------------------------------------------- 1 | // Author : youtube channel-dotnetmob 2 | // Date : 21-Jun-2015 3 | // Description : program for clock 4 | 5 | #include 6 | #include 7 | #include 8 | void main() 9 | { 10 | struct time t; 11 | struct arccoordstype sec_arc, min_arc, hr_arc; 12 | int i; 13 | int gd = DETECT,gm; 14 | initgraph(&gd,&gm,"c://TurboC3//BGI"); 15 | setcolor(RED); 16 | //Outer circle 17 | circle(320,240,100); 18 | circle(320,240,99); 19 | //Inner circle 20 | circle(320,240,80); 21 | circle(320,240,81); 22 | setcolor(WHITE); 23 | //mark four points 24 | line(320,160,320,165);//top 25 | line(320,320,320,325);//bottom 26 | line(400,240,395,240);//left 27 | line(240,240,245,240);//right 28 | 29 | while(!kbhit()) 30 | { 31 | printf("Time is : %2d:%2d:%3d\r",t.ti_hour%12, t.ti_min, t.ti_sec); 32 | setcolor(0); 33 | line(320,240, sec_arc.xend, sec_arc.yend); 34 | line(320,240, min_arc.xend, min_arc.yend); 35 | line(320,240, hr_arc.xend, hr_arc.yend); 36 | //Store time into struct t 37 | gettime(&t); 38 | //hour 39 | setcolor(0); 40 | arc(320,240,270,90-(t.ti_hour*6*5),55); 41 | setcolor(YELLOW); 42 | getarccoords(&hr_arc); 43 | line(320,240, hr_arc.xend, hr_arc.yend); 44 | //minute 45 | setcolor(0); 46 | arc(320,240,270,90-t.ti_min*6,65); 47 | setcolor(CYAN); 48 | getarccoords(&min_arc); 49 | line(320,240, min_arc.xend, min_arc.yend); 50 | //center circle 51 | setcolor(WHITE); 52 | pieslice(320,240,0,360,5); 53 | //second 54 | setcolor(0); 55 | arc(320,240,270,90-t.ti_sec*6,75); 56 | setcolor(RED); 57 | getarccoords(&sec_arc); 58 | line(320,240, sec_arc.xend, sec_arc.yend); 59 | delay(250); 60 | } 61 | getch(); 62 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CG Program For Clock in C programming 2 | Computer Graphics Program For Clock 3 | 4 | ## Get the Code 5 | 6 | ``` 7 | $ git clone https://github.com/CodAffection/CG-Program-For-Clock.git 8 | ``` 9 | 10 | ## How it works ? 11 | 12 | :tv: Video tutorial on this same topic 13 | Url : https://youtu.be/QGKfQDf5n_I 14 | 15 | Demo for Computer Graphics Program For Clock 18 | 19 | 20 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 21 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 22 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 23 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 24 | | React |http://bit.ly/325temF | | 25 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 26 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 27 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 28 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 29 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 30 | | MEAN Stack |https://goo.gl/YJPPAH | | 31 | | C# Tutorial |https://goo.gl/s1zJxo | | 32 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 33 | | C# WinForm |https://goo.gl/vHS9Hd | | 34 | | MS SQL |https://goo.gl/MLYS9e | | 35 | | Crystal Report |https://goo.gl/5Vou7t | | 36 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 37 | --------------------------------------------------------------------------------