画棋格

 1 #include<graphics.h>//initgraph的头文件
 2 #include<conio.h>//gech()的头文件
 3 int main()
 4 {
 5     initgraph(640,480);//开辟一个640*480的窗口
 6     for(int y=100;y<=300;y+=10)
 7     {
 8         setcolor(RGB(0,0,255));//选择颜色
 9         line(100,y,300,y);//画直线
10     }
11     for(int x=100;x<=300;x+=10)//调用循环画直线
12     {
13         setcolor(RGB(255,0,0));
14         line(x,100,x,300);
15     }
16     getch();//随便输入一个字符 关闭窗口
17   closegraph();
18 }
View Code

 

posted on 2014-04-02 22:05  一颗向上的草莓  阅读(107)  评论(0编辑  收藏  举报