>[info]画图,综合例子2。(在TC中实现)。
~~~C
#include "graphics.h"
#define LEFT 0
#define TOP 0
#define RIGHT 639
#define BOTTOM 479
#define LINES 400
#define MAXCOLOR 15
int main()
{
int driver,mode,error;
int x1,y1;
int x2,y2;
int dx1,dy1,dx2,dy2,i=1;
int count=0;
int color=0;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,"");
x1=x2=y1=y2=10;
dx1=dy1=2;
dx2=dy2=3;
while(!kbhit())
{
line(x1,y1,x2,y2);
x1+=dx1;y1+=dy1;
x2+=dx2;y2+dy2;
if(x1<=LEFT||x1>=RIGHT)
dx1=-dx1;
if(y1<=TOP||y1>=BOTTOM)
dy1=-dy1;
if(x2<=LEFT||x2>=RIGHT)
dx2=-dx2;
if(y2<=TOP||y2>=BOTTOM)
dy2=-dy2;
if(++count>LINES)
{
setcolor(color);
color=(color>=MAXCOLOR)?0:++color;
}
}
closegraph();
}
~~~
- C语言模块
- 基础入门
- 各种变量类型
- 条件编译
- 100例
- day1
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day2
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day3
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day4
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day5
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day6
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day7
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- linux基础知识
- 目录
- 系统设置
- ftp管理
- ftp-auth
- 进程
- ssh登录
- 权限属性
- 用户/用户组
- 安装命令
- 数据库操作
- 虚拟机vmvare-tools安装
- VI命令
- 上传下载
- error
- 虚拟机mac