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;
}

EasyX绘制国际象棋棋盘

上一篇:算法第五章实践报告


下一篇:Leetcode 题组 40