C作图,能编译,不能运行

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:45:07
#include<graphics.h>
main()
{
int graphdriver=DETECT;
int graphmode;
inigraph(&graphdriver,&graphmode,"");
cleardevice();
moveto(200,100);
lineto(60,250);
getch();
closegraph();
return 0;

}
请问下高手,这里在TC3.0下怎么会不能运行呢?编译还没错呢?就是不能运行…………
#include<graphics.h>
#include<stdio.h>
void main()
{
int graphdriver=VGA;
int graphmode=CGAC0;
int x;
inigraph(&graphdriver,&graphmode,"");
cleardevice();
for(x=20;x<=300;x+=16)
{
putpixel(x,20,1);
putpixel(x+4,20,2);

}

getch();
closegraph();

}
这个也是这样,请在线的朋友帮我呀,我急呀……
还有,会奖赏20分的

你是在windows下运行显示..遇到错误的指令,需要关闭之类的东西是吧?
不能在windows下直接运行,用DosBox0.72或VDMSound运行

TC。。
多半是路径设置的问题

inigraph(&graphdriver,&graphmode,"");

的参数3字符串写你的TC安装目录(或者它的一个子目录,记不大清楚了),里面因该有几个 .BGI 后缀文件的

编译的时候用的动态库,也就是graphics,运行的时候需要起用这个库,但是那个是dos的图形库,windows没有。
你要是在纯dos就能运行。
想在windows运行,换库!