0
我寫DDALine算法在Visual-Studio和C++,但視覺工作室說DDALine在Visual Studio C++
'的putpixel':標識符找不到.....
我m使用graphics.h
,但是不起作用?
我的源代碼
#include "graphics.h"
#include "stdlib.h"
#include "stdio.h"
#include "conio.h"
#include "dos.h"
#include "stdafx.h"
#include "math.h"
void ddaline(int x1,int y1,int x2,int y2,int color)
{
int dx,dy,len,i;
float xinc,yinc,x,y;
dx=x2-x1;
dy=y2-y1;
if (abs(dx)>abs(dy))
len=abs(dx);
else
len=abs(dy);
if (len!=0)
{
xinc=((dx*1.0)/(len));
yinc=((dy*1.0)/(len));
}
x=x1;
y=y1;
for(i=0;i<=len;i++)
{
putpixel(x,y,color);
x=x+xinc;
y=y+yinc;
}
}
void main()
{
ddaline(1,1,640,400,4);
}