我想问我是用的vs,我怎么用vs编译下面的代码?关键是那个头文件#include<graphics.h>要报错啊,怎么办? 50
#include<stdio.h>#include<graphics.h>#include<math.h>#defineYS100000bresenham_line(in...
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#define YS 100000
bresenham_line(int x0,int y0,int x1,int y1,int c)
{
int x,y,dx,dy,e,i;
dx=x1-x0;
dy=y1-y0;
e=-dx;
x=x0,y=y0;
for(i=0;i<=dx;i++)
{
putpixel(x,y,c++);/*c++不同描点不同颜色*/
delay(YS);
x++,e=e+2*dy;
if(e>0){y++;e=e-2*dx;}
}
}
main()
{
int x0=100,y0=100,x1=200,y1=200,c=1;
int gdriver,gmode;
gdriver=DETECT;
initgraph(&gdriver,&gmode," ");
bresenham_line(x0,y0,x1,y1,c);
getch();
closegraph();
} 展开
#include<graphics.h>
#include<math.h>
#define YS 100000
bresenham_line(int x0,int y0,int x1,int y1,int c)
{
int x,y,dx,dy,e,i;
dx=x1-x0;
dy=y1-y0;
e=-dx;
x=x0,y=y0;
for(i=0;i<=dx;i++)
{
putpixel(x,y,c++);/*c++不同描点不同颜色*/
delay(YS);
x++,e=e+2*dy;
if(e>0){y++;e=e-2*dx;}
}
}
main()
{
int x0=100,y0=100,x1=200,y1=200,c=1;
int gdriver,gmode;
gdriver=DETECT;
initgraph(&gdriver,&gmode," ");
bresenham_line(x0,y0,x1,y1,c);
getch();
closegraph();
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询