资源描述:
《绘制中国象棋棋盘(c语言)》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、//编译运行环境vs2013//作者:E蓑烟雨//QQ:1194758555,一起交流学习。//修改时间按:2015-05-13#include#includeintmain(){initgraph(600,800);//初始化绘图环境setorigin(300,400);//设置原点setbkcolor(RGB(225,160,115));//设置绘图背景色cleardevice();//用上面背景色清空屏幕setlinecolor(RED);//设置线条颜色setlinestyle
2、(PS_SOLID
3、PS_ENDCAP_FLAT,4);//设置线条格式for(inti=-280;i<=280;i=i+70)//画y轴负半轴平行于y轴线{line(i,-360,i,-78);}for(inti=-360;i<=-70;i=i+70)//画y轴负半轴平行于x轴线{line(-280,i,280,i);}for(inti=0;i<=280;i=i+70)//画y轴正半轴平行于y轴线{line(-280,i,280,i);}for(inti=-280;i<=280;i=i+70)//画y轴正半轴平行于x轴线{l
4、ine(i,280,i,0);}line(-71,-360,70,-219);//画y轴负半轴帅的位置line(-70,-219,70,-360);line(-70,280,70,140);//画y轴正半轴将的位置line(-70,140,70,280);line(-274,-153,-274,-170);//画y轴负半轴车的位置line(-276,-155,-276+15,-155);line(-274,-147,-274,-129);line(-276,-145,-276+15,-145);for(inti=-135;i<
5、=275;i+=140){line(i,-153,i,-170);line(i,-147,i,-129);line(i,-155,i+15,-155);line(i,-145,i+15,-145);}line(274,-153,274,-170);line(276,-155,276-15,-155);line(274,-147,274,-129);line(276,-145,276-15,-145);for(inti=-145;i<=272;i+=140){line(i,-153,i,-170);line(i,-147,i,-
6、129);line(i,-155,i-15,-155);line(i,-145,i-15,-145);}line(-215,-223,-215,-240);line(-215,-225,-215-15,-225);line(-215,-217,-215,-200);line(-215,-215,-215-15,-215);line(-205,-223,-205,-240);line(-205,-225,-205+15,-225);line(-205,-217,-205,-200);line(-205,-215,-205+15,
7、-215);line(215,-223,215,-240);line(215,-225,215+15,-225);line(215,-217,215,-200);line(215,-215,215+15,-215);//line(205,-223,205,-240);line(205,-225,205-15,-225);line(205,-217,205,-200);line(205,-215,205-15,-215);line(-274,67,-274,50);//画y轴正半轴车的位置line(-274,65,-274+15
8、,65);line(-274,73,-274,90);line(-274,75,-274+15,75);for(inti=-135;i<=275;i+=140){line(i,67,i,50);line(i,73,i,90);line(i,65,i+15,65);line(i,75,i+15,75);}line(274,67,274,50);line(274,65,274-15,65);line(274,73,274,90);line(274,75,274-15,75);for(inti=-145;i<=272;i+=140)
9、{line(i,67,i,50);line(i,73,i,90);line(i,65,i-15,65);line(i,75,i-15,75);}line(-215,135,-215,118);//画y轴负半轴半炮的位置line(-213,135,-213-15,135);li