有关c语言图形函数的问题

来源:百度知道 编辑:UC知道 时间:2024/06/10 15:01:03
#include<stdlib.h>
#include<graphics.h>
int main()
{
int gdriver, gmode, i;
int arw[16]={200, 102, 300, 102, 300, 107, 330,
100, 300, 93, 300, 98, 200, 98, 200, 102};
gdriver=DETECT;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
setcolor(12); /*设置作图颜色*/
drawpoly(8, arw); /*画一箭头*/
getch();
closegraph();
return 0;
}
这是一个画箭头的图形函数例子,用vc++为什么不能运行,说Cannot open include file: 'graphics.h': No such file or directory,用tc的话,会说打不开头文件stdlib.h和graphics.h。还有,graphics.h是不是很多编程用的软件都不含这个头文件啊
呃,那个问题解决了,不过还想知道为什么运行后,还说function "getch"should have a prototype?

<graphics.h>是TC里面图形库函数的头文件,如果要用的话应该用TC来编。
graphics.h 和 里面定义的绘图函数都是 Turbo C 的,VC++中无法运行。

VC++ 一般用 CDC 类函数。

>问题补充:呃,那个问题解决了,不过还想知道为什么运行后,还说
>function "getch"should have a prototype?
这个是你没有#include<conio.h>的原因