此篇文章主要应用了函数库中的基本函数(COLORREF、circle)进行作图。
#include “graphics.h” // 就是需要引用这个图形库
#include <conio.h>
void main()
{
initgraph(600, 400); // 这里和 TC 略有区别
COLORREF color = RGB(255, 255, 255);
for (int i = 0; i < 30; i++)
{
color = RGB(i * 8, 255, 255);
setcolor(color);
circle(10 * i, 200, i * 3);// 画圆,圆心(200, 200),半径 100
}
system("pause"); // 按任意键继续
closegraph(); // 关闭图形界面
}
注:这里使用的 #include “graphics.h” 在相应的工程文件中需要加上插件:
具体可以在百度上下载此插件。