Coders Packet

Analog Clock using C++ graphics

By kumari Ayushi Sinha

The Analog Clock project has been designed and developed in the C++ programming language with the help of graphics.h and ctime library.

This program implements an Analog Clock designed with the help of a graphics library in C++.
Following functions have been used to design the layout of the clock:
1) circle(int x, int y , int radius)
2) line(int x1, int y1 ,int x2, inty2 )
3) setlinestyle(int linestyle, unsigned upattern,int thickness);
4)outtextxy(int x ,int y ,"text")
5)setcolor(int color)

The time has been accessed with the help of #include library in the program.
The following piece of code gives the current date/time based on the current system:
       
time_t now = time(0); 
 

Steps-

1) Download and extract the zip file and open it in Dev c++ or Codeblocks
2) One must have the graphics header file to run it.
3)Select the graphics console option while saving the file.
4)Select the TDM-GCC 4.9.2 32-bit Release option in Dev c++ before compiling the program.
5)Click on compile and run.
6)The analog clock displays the time in 12 hours format. Press the enter key to exit the console.

Download Complete Code

Comments

No comments yet