EasyX绘制国际象棋棋盘
作者:互联网
#include <graphics.h>
#include <conio.h>
#define HIGH 400
#define WIDTH 400
int main(void)
{
initgraph(WIDTH, HIGH);
setbkcolor(WHITE);
cleardevice();
for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
if (((i % 2 == 1) && (j % 2 == 0)) || ((i % 2 == 0) && (j % 2 == 1)))
{
setfillcolor(BLACK);
}
else
{
setfillcolor(WHITE);
}
setcolor(BLACK);
fillrectangle(i * 40, j * 40, i * 40 + 40, j * 40 + 40);
}
}
_getch();
closegraph();
return 0;
}
标签:int,国际象棋,EasyX,40,WIDTH,BLACK,400,棋盘,define 来源: https://blog.csdn.net/tanjuan918/article/details/121986336