-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CH24_2.CPP
27 lines (25 loc) · 808 Bytes
/
CH24_2.CPP
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
/* ============== Program Description ============= */
/* program name : ch24_2.c */
/* draw a interesting picture using line() */
/* ================================================== */
#include <graphics.h>
#include <math.h>
#include <conio.h>
void main(void)
{
int driver = DETECT,mode;
int x[10],y[10];
int x_center = 360, y_center = 180, rad = 100;
int i,j;
initgraph(&driver,&mode,"c:\\tc\\bgi");
for ( i = 0; i < 10; i++ )
{
x[i] = x_center + rad * cos(36*i*3.14159/180);
y[i] = y_center + rad * sin(36*i*3.14159/180);
}
for ( i = 0; i < 10; i++ )
for ( j = 0; j < 10; j++ )
line(x[i],y[i],x[j],y[j]);
getch(); /* press any key return to TEXT mode */
closegraph();
}