这是我以前写过的用TurbC画图的简单例子,大家给参考下

0 views
Skip to first unread message

来凯

unread,
Mar 30, 2009, 11:08:41 AM3/30/09
to 周立功C语言俱乐部
#include <stdio.h>
#include <conio.h>
#include <bios.h>
#include <dos.h>
#include <math.h>

#include <graphics.h>


main()
{

int maxx,maxy;
int mx,my;
int i,x,y;
float temp;
int scode;
int gdriver=DETECT, gmode;
initgraph(&gdriver,&gmode,"");

maxx=getmaxx();
maxy=getmaxy();

mx=maxx/2;
my=maxy/2;
setcolor(YELLOW);
circle(mx,my,60);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(mx,my,YELLOW);

scode=0;
while (scode!=283)
{
for(i=0; i<=360; i++)
{

temp=i*3.1415927/180.0;
x=200.0*cos(temp)+mx;
y=200.0*sin(temp)+my;

setcolor(LIGHTBLUE);
circle(x,y,20);
setfillstyle(SOLID_FILL,LIGHTBLUE);
floodfill(x,y,LIGHTBLUE);
delay(10000);
setcolor(WHITE);
circle(x,y,20);

setfillstyle(SOLID_FILL,WHITE);
floodfill(x,y,WHITE);

if ((scode=bioskey(1))!=0)
{
bioskey(0);
if (scode==283) break;
}
}
}
cleardevice();
}

张辉

unread,
Mar 30, 2009, 8:38:30 PM3/30/09
to 周立功C语言俱乐部
蛮有意思的...
> }- 隐藏被引用文字 -
>
> - 显示引用的文字 -

along meng

unread,
Mar 31, 2009, 1:28:09 AM3/31/09
to zl...@googlegroups.com
建议发代码时能够加点注释,这样对于好多新手就容易看懂代码。比如这里关于键盘扫描码(esc 为283)的问题,可能还有一些人不太了解.

孟阿龙

unread,
Mar 31, 2009, 1:33:26 AM3/31/09
to 周立功C语言俱乐部

要是能加点注释就好多了,毕竟大家不了解你的程序思想或功能,另外程序中涉及到的一些东西可能还有人懂。
比如这里的键盘扫描码的问题

赵力

unread,
Apr 2, 2009, 9:57:42 AM4/2/09
to zl...@googlegroups.com


2009/3/31 along meng <boya...@gmail.com>

建议发代码时能够加点注释,这样对于好多新手就容易看懂代码。比如这里关于键盘扫描码(esc 为283)的问题,可能还有一些人不太了解.

就是。。。
Reply all
Reply to author
Forward
0 new messages