扫雷背景

 1 #include <graphics.h>
 2 #include <conio.h>
 3 void k(int x,int y)
 4 {int a,b;
 5       setcolor(RGB(200,200,200));
 6       for(a=x,b=y;a>x-4&&b<y+4;b++,a--)
 7           line(x, b, a+40, b);
 8       for(a=x,b=y;a<x+4&&b>y-4;a++,b--)
 9           line(a, y, a, b+40);
10       setcolor(RGB(55,55,55));
11       for(a=x,b=y;a>x-4&&b<y+4;b++,a--)
12           line(a+40, b, a+40, b+40);
13       for(a=x,b=y;a<x+4&&b>y-4;b--,a++)
14           line(a, b+40, a+40, b+40);
15 }
16 void main()
17 {int i,j;
18       initgraph(640, 640);
19       setbkcolor(RGB(127,127,127));
20 cleardevice();
21 for(i=0;i<=640;i+=40)
22     for(j=0;j<=640;j+=40)
23         k(i,j);
24       getch();
25       closegraph();
26 }
View Code
原文地址:https://www.cnblogs.com/firstsy0709/p/3643855.html