Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/150.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
visualstudioc+中的DDALine+; 我在Visual Studio中用C++编写DDALIN算法,但VisualStudio说_C++_Visual C++ - Fatal编程技术网

visualstudioc+中的DDALine+; 我在Visual Studio中用C++编写DDALIN算法,但VisualStudio说

visualstudioc+中的DDALine+; 我在Visual Studio中用C++编写DDALIN算法,但VisualStudio说,c++,visual-c++,C++,Visual C++,“putpixel”:找不到标识符 我正在使用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,le

“putpixel”:找不到标识符

我正在使用
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);



  }
#包括“graphics.h”
#包括“stdlib.h”
#包括“stdio.h”
#包括“conio.h”
#包括“dos.h”
#包括“stdafx.h”
#包括“math.h”
无效ddaline(整数x1、整数y1、整数x2、整数y2、整数颜色)
{
int-dx,dy,len,i;
浮点数xinc,yinc,x,y;
dx=x2-x1;
dy=y2-y1;
如果(abs(dx)>abs(dy))
len=abs(dx);
其他的
len=abs(dy);
如果(len!=0)
{
xinc=((dx*1.0)/(len));
银币=((dy*1.0)/(len));
}
x=x1;
y=y1;
对于(i=0;i <代码> <代码> >代码> <代码>不是C++标准头。您在项目旁边有它们吗?!
<>你应该在Turbo C++中测试你的代码,也许是用DOSBOX(新的Windows版本不支持DOS全屏模式)