+ 1

How we create clock program in C language

16th Oct 2018, 3:17 AM
Thakare Sagar
Thakare Sagar - avatar
3 Réponses
+ 4
With only C/C++'s built-in facilities, and without using external graphical libraries, you probably should know 3 things: 1. How to draw simple lines using one of the famous line algorithms like DDA, or Bresenham's line algorithm, etc. for clock hands. 2. How to draw circle with a formal algorithm like Bresenham's circle algorithm or in its rough form, with less precision, using a custom conversion from Polar to Cartesian coordinate and get the respective pair of (x, y) for each minute-mark of the clock face/dial as x = r * sin(current angle); y = r * cos(current angle); r is the radius of the clock face. current angle is in the range of [0 to 360) 3. How to use a 2D matrix as a dot-matrix LED emulator and fill it with outcome of every stage of drawing. For more details about how things work together as a unit, refer to my example, specifically AnalogC class (started from the line 402 and ended to line 587) https://code.sololearn.com/cCzwjQ900N11/?ref=app
16th Oct 2018, 10:36 AM
Babak
Babak - avatar
+ 2
Thakare Sagar TS_Creation Add a description to your questions. Basically use a function to get the time. Rendering/ drawing one not a simple task for C. I could make one using Sdl2. https://www.sololearn.com/discuss/498964/?ref=app
16th Oct 2018, 5:08 AM
Manual
Manual - avatar
+ 1
plz bro help me plz ans in C language i learn only C lang
16th Oct 2018, 1:03 PM
Thakare Sagar
Thakare Sagar - avatar