c语言!你懂吗?

来源:百度知道 编辑:UC知道 时间:2024/06/01 03:16:09
include <graphics.h>
int main()
{
int gdriver, gmode;
gdriver=VGA;
gmode=VGAHI;
initgraph(&gdriver, &gmode, "c:\\tc");
bar3d(100, 100, 300, 250, 50, 1); /*画一长方体*/
getch();
closegraph();
return 0;
}

能 运行,可是没结果!
提示: BGI Error:Graphics not initialized (use 'initgraph')
能告诉我是怎么回事吗?
其实最开始处有那个#
我写上来的时候忘写了!
还有一楼的说!return 0;返回错了!
能告诉我怎么返回吗?我也是让它返回零!

initgraph
函数名: initgraph()
功 能: 初始化图形系统
函数原型: void far initgraph(int far *graphdriver, int far *graphmode,
char far *pathtodriver);
头文件:graphics.h
程序例:

#include "graphics.h"
#include "stdio.h"

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;

/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* return with error code */
}

/* draw a line */
line(0, 0, getmaxx(), getmaxy());

/* clean up */
getch();
closegraph();
return 0;
}

错误是说图形不能初始化,我没