代码是这样
#include <graphics.h>
#include <conio.h>
#include <math.h>
void main()
{
initgraph(640, 480);
int c;
double a,PI=3.1415926535897932384626433832795028841971;
double x, y, r = 200;
for (a = 0; a<PI * 2; a +=0.0001)
{
x = (r*cos(a) + 320);
y = (r*sin(a) + 240);
c = (int)(a * 255 / (2 * PI));
setcolor(RGB(c, 0, 0));
line(320, 240, x, y);
}
getch();
closegraph();
}
#include <graphics.h>
#include <conio.h>
#include <math.h>
void main()
{
initgraph(640, 480);
int c;
double a,PI=3.1415926535897932384626433832795028841971;
double x, y, r = 200;
for (a = 0; a<PI * 2; a +=0.0001)
{
x = (r*cos(a) + 320);
y = (r*sin(a) + 240);
c = (int)(a * 255 / (2 * PI));
setcolor(RGB(c, 0, 0));
line(320, 240, x, y);
}
getch();
closegraph();
}