注册 登录
编程论坛 C图形专区

有关 画图的 问题

realll 发布于 2010-02-13 14:45, 1083 次点击
1学用circle画圆形       2学用line画直线        3学用rectangle画方形

想请教 各位大虾 怎么用C语言做 画图的程序呢?
                   思路是怎样的?
                   一般会用到什么函数
谢谢各位




1
/*circle*/
#include "graphics.h"
main()
{int driver,mode,i;
float j=1,k=1;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
for(i=0;i<=25;i++)
{
setcolor(8);
circle(310,250,k);
k=k+j;
j=j+0.3;
}
}  

2

#include "graphics.h"
main()
{int driver,mode,i;
float x0,y0,y1,x1;
float j=12,k;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(GREEN);
x0=263;y0=263;y1=275;x1=275;
for(i=0;i<=18;i++)
{
setcolor(5);
line(x0,y0,x0,y1);
x0=x0-5;
y0=y0-5;
x1=x1+5;
y1=y1+5;
j=j+10;
}
x0=263;y1=275;y0=263;
for(i=0;i<=20;i++)
{
setcolor(5);
line(x0,y0,x0,y1);
x0=x0+5;
y0=y0+5;
y1=y1-5;
}
}



3
#include "graphics.h"
main()
{int x0,y0,y1,x1,driver,mode,i;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
x0=263;y0=263;y1=275;x1=275;
for(i=0;i<=18;i++)
{
setcolor(1);
rectangle(x0,y0,x1,y1);
x0=x0-5;
y0=y0-5;
x1=x1+5;
y1=y1+5;
}
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);

 outtextxy(150,40,"How beautiful it is!");
line(130,60,480,60);
setcolor(2);
circle(269,269,137);
}




这是有关代码    我只看的懵懵懂懂    希望大家说点思路

[ 本帖最后由 realll 于 2010-2-13 16:40 编辑 ]
2 回复
#2
稀饭小超人2010-02-13 16:07
- -还不会哦~帮楼主顶了
#3
sainimu782010-02-15 16:26
关于函数怎么用的问题 与其发贴等人回不如自己百度 函数的用法问题不是技术性问题呢  建议楼主百度 "C语言 库函数大全"  或者就在 本论坛下一个 库函数查询程序 传送门->https://bbs.bccn.net/thread-82391-1-1.html
1