In this article, it is discussed how to design a Pendulum Clock in the C programming language using Graphics.
Approach:
- Create two rectangles, one inside the other, using the rectangle() function to act as the outer outline of the clock & the other is the inner outline of the clock.
- Color the space between the two rectangles brown using setfillstyle() and floodfill() functions
- Implement a circle inside the inner rectangle using the circle() function
- Color all other parts leaving the circle with dark gray using setfillstyle() and floodfill() functions.
- In the circle, insert all the digits using settextstyle() and outtextxy() functions.
- Calculate the coordinates of the digits.
- Implement the pendulum with two lines by using the line() function & another circle by using the circle() function which will act as the bob.
- Color all of them black using the setfillstyle() and floodfill() functions again.
- Implement hour, minute & second hands by using the line() function.
- Color the objects individually by using the setcolor() function.
Below is the implementation of the above approach:
Output:
👁 Image