程序无法运行,求助!

xianbin 2003-03-25 09:11:23
下面的程序无法编译通过,劳驾大家帮忙看看.
编译器:TC3.0



///////////////////////////////////////////////////////////
//3DDEMO.CPP:Ssimple 3-D graphics drawing demonatration.
// Make sure that Borland's EGAVGA.BGI
// graphics driver is in the same directory
// as the program.
//////////////////////////////////////////////////////////
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<iostream.h>
#include<graphics.h>

//function prototypes.
void StartGraphics(void);
void DrawGraphics(void);

/////////////////////////////////////////////////////////
//main()
////////////////////////////////////////////////////////
int main(void)
{
//Initialize VGA graphics.
StartGraphics();

//Draw the 3-D graphics.
DrawGraphics();

//Wait for a keypress.
getch();
return 1;
}

////////////////////////////////////////////////////
//DrawGraphics()
///////////////////////////////////////////////////
void DrawGraphics(void)
{
//Set the fill style and color.
setfillstyle(SOLID_FILL,LIGHTGRAY);

//raw a gray background rectangle.
bar(100,100,300,240);

//Draw the top,protruding 3-D rectangle.
setcolor(WHITE);
moveto(120,160);
lineto(120,120);
lineto(279,120);
setcolor(BLACK);
moveto(120,160);
lineto(279,160);
lineto(279,160);
lineto(279,120);

//Draw the bottom,indented 3-D rectangle.
moveto(120,220);
lineto(120,180);
lineto(279,180);
setcolor(WHITE);
moveto(120,220);
lineto(279,220);
lineto(279,180);
}

//////////////////////////////////////////////////////////
//StartGraphics()
//
//This function initializes Borland's graphics driver
//for the high-resolution VGA screen.
//////////////////////////////////////////////////////////
void StartGraphics(void)
{
int gdriver=VGA,gmode=VGAHI,errorcode;

initgraph(&gdriver,&gmode,"");
/* if( (errorcode=graphresult() )!=0)
{
cout<<"Graphics error:"<<errorcode<<'\n';
getch();
abort();
}
*/
}
...全文
26 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjtuzhw 2003-03-27
  • 打赏
  • 举报
回复
是不是本身用的tc内库不全呀
搞不懂,程序本身应该没有什么错误的,估计只是调用的过程有问题
xianbin 2003-03-27
  • 打赏
  • 举报
回复
那些头文件都有,系统只是提示找不到那些函数,比如moveto之类的.只要是graphics.h里头用到的都没有.
liushmh 2003-03-25
  • 打赏
  • 举报
回复
这两个文件肯定都有,你看看你的directory是否设置正确?
或者把错误拿出来看看。
wengzhong 2003-03-25
  • 打赏
  • 举报
回复
#include<iostream.h>//Tc3.0有这个头文件吗??我没有用过TC3.0请你检查一下
#include<graphics.h>//同时检查有没有这个.

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧