先贴效果图给大家先看看
基本机制是通过获取系统的时钟去绘制图线进行展示
贴出代码 ,大家可以直接使用的 .程序我进一步的讲解
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <time.h>
#define high 480
#define width 640
#define pi 3.141592
int main()
{
initgraph(high, width);
int center_x, center_y;
center_y = width / 2; // 320
center_x = high / 2; // 240
SYSTEMTIME ti; //获取系统的时间
// 秒针属性
int secondEnd_x, secondEnd_y;
int secondLenth = 120;
secondEnd_x = center_x + secondLenth;
secondEnd_y = center_y;
float secondAngle = 0;
// 分钟属性
int minuteEnd_x, minuteEnd_y;
float minuteAngle = 0;
int minuteLenth = 90;
minuteEnd_x = center_x + minuteLenth;
minuteEnd_y = center_y + minuteLenth;
// 时钟属性
int hoursEnd_x, hoursEnd_y;
float hoursAngle = 0;