用这个代码运行不出结果,错误如下,该怎么解决
#include<iostream>
#include<math.h>
#include<time.h>
#include<Windows.h>
#include <wtypes.h>
#include <conio.h>
#include <graphics.h>
#define PI 3.1415926
#define ESC 0x011b
int s0 = -1, m0 = -1, h0 = -1;
int main()
{
int key, i = 3;
char H[10];
float n;
HDC hdc = GetDC(GetConsoleWindow());
HPEN hpen = CreatePen(PS_SOLID, 1, RGB(0, 0, 225));
SelectObject(hdc, hpen);
Ellipse(hdc, 380, 150, 430, 200);
Ellipse(hdc, 210, 150, 260, 200);
Ellipse(hdc, 295, 225, 345, 275);
Ellipse(hdc, 297, 227, 343, 273);
for (n = 0; n <= 2 * PI; n += PI / 30)
{
MoveToEx(hdc, 320, 240, NULL);
LineTo(hdc, 320 + 80 * cos(-n), 240 + 80 * sin(-n));
}
for (n = 0; n <= 2 * PI; n += PI / 6)
{
itoa(i, H, 10);
TextOutA(hdc, 317 + 73 * cos(-n), 237 + 73 * sin(-n), H, strlen(H));
i--;
if (i < 1)
i += 12;
}
while (!kbhit())
{
timer();
Sleep(1000);
}
key = getch();
if (key == ESC)
{
ReleaseDC(GetConsoleWindow(), hdc);
exit(0);
}
return 0;
}
void timer()
{
struct tm* when;
float s, m1, h1;
int h, m;
time_t now;
time(&now);
when = localtime(&now);
h = when->tm_hour;
m = when->tm_min;
s = when->tm_sec;
h1 = (h + (m * 60 + s) / 3600) * PI / 6 - PI / 2;
m1 = (m + s / 60) * (PI / 30) - PI / 2;
if (s0 != (-1) && m0 != (-1) && h0 != (-1))
{
setcolor(0);
line(320, 240, 320 + 45 * cos(h0), 240 + 45 * sin(h0));
line(320, 240, 320 + 55 * cos(m0), 240 + 55 * sin(m0));
line(320, 240, 320 + 65 * cos(s0), 240 + 65 * sin(s0));
}
setcolor(15);
line(320, 240, 320 + 45 * cos(h1), 240 + 45 * sin(h1));
line(320, 240, 320 + 55 * cos(m1), 240 + 55 * sin(m1));
setcolor(4);
line(320, 240, 320 + 65 * cos(s * (PI / 30) - PI / 2), 240 + 65 * sin(s * (PI / 30) - PI / 2));
s0 = s * (PI / 30) - PI / 2;
m0 = m1;
h0 = h1;
}