-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLab 1_Circle.C
More file actions
48 lines (37 loc) · 748 Bytes
/
Copy pathLab 1_Circle.C
File metadata and controls
48 lines (37 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
int main()
{
int gd = DETECT, gm, errorcode;
int mid_x, mid_y;
int radius, color;
clrscr();
initgraph(&gd, &gm, "C:\\TURBOC3\\BGI");
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(EXIT_FAILURE); /* terminate with an error code */
}
mid_x = getmaxx()/2;
mid_y = getmaxy()/2;
color = 0;
radius = 0;
while (1)
{
setcolor(color++);
circle(mid_x, mid_y, radius);
radius += 10;
if ((mid_x - radius) <= 0)
break;
if ((mid_y - radius) <= 0)
break;
}
getch();
closegraph();
return 0;
}