谁能告诉我,在vc++6.0下的图形头文件是什么?
以下程序在borland下编译正常,但在vc下却提示graphics.h未定义。
#include <graphics.h>class square
{
int x,y;
int length;
public:
square(int vx,int vy,int vlength);
int area();
void show();
};
class circle
{
int x,y;
int length;
public:
circle(int vx,int vy,int vlength);
float area();
void show();
};
square::square(int vx,int vy,int vlength)
{
x=vx;
y=vy;
length=vlength;
}
circle::circle(int vx,int vy,int vlength)
{
x=vx;y=vy;length=vlength;
}
int square::area()
{
return length*length;
}
float circle::area()
{
return 3.1416*length*length/4;
}
void circle::show()
{
circle(x,y,length/2);
}
void square::show()
{
square(x-length/2,y-length/2,x+length/2,y+length/2);
}
main()
{
char *str1,*s1,*str2,*s2;
square s(200,200,100);
circle c(200,200,70);
int gdrive=DETECT,gmode;
initgraph(&gdrive,&gmode," ");
setcolor(4);
s.show();
setcolor(14);
c.show();
setcolor(5);
itoa(s,area(),str1,10);
s1="square area:";
gcvt(c.area(),10,str2);
s2="circle area:";
strcat(s1,str1);
strcat(s2,str2);
outtextxy(20,400,s1);
outtextxy(20,440,s2);
getch();
closegraph();
return 1;
}

解决方案 »

  1.   

    DOS下的头文件已经被取消了!
      

  2.   

    用GDI的函数
      
       
     
    Chord  
    Ellipse  
    FillRect  
    FrameRect  
    InvertRect  
    Pie  
    Polygon  
    PolyPolygon  
    Rectangle  
    RoundRect  
    AngleArc  
    Arc  
    ArcTo  
    GetArcDirection  
    LineDDA  
    LineDDAProc  
    LineTo  
    MoveToEx  
    PolyBezier  
    PolyBezierTo  
    PolyDraw  
    Polyline  
    PolylineTo  
    PolyPolyline  
    SetArcDirection  
      

  3.   

    没看到有图形文件头,在DOS下面,你可以去下载一个WINTC。或者你自己在DOS下面写一个,呵,
      

  4.   

    Header: Wingdi.h; include Windows.h.
     Library: Use Gdi32.lib.
      

  5.   

    DOS下的图形程序转移到Windows环境,不是一两句话说得清楚的,最好先学习一下Windows的编程概念和基本技巧,再回过头来修改。