C语言高手来纠正下错误啊!

来源:百度知道 编辑:UC知道 时间:2024/06/01 15:04:36
以下不是我写的,但是这个程序打不开...自己看了下,但是找不出哪里有问题,额,不够认真...
/*进入tc运行游戏,按上下左右键控制,任何时候按ESC键退出*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <graphics.h>
#define LEFT 120
#define TOP 40
#define RIGHT 520
#define BOTTOM 440
#define SMALL 20
int b[20][20]; /*用来保存地图信息*/
b[20][20]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1},
{1,0,1,0,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,1},
{1,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1},
{1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,1},
{1,1,1,0,1,1,1,0,1,1,1,1,0,0,1,0,0,1,0,1},
{1,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1},
{1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1},
{1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1},
{1,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,1,1},
{1,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,0,1},
{1,0,1,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1},
{1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1

程序是没有错误的,不能编译的原因是你没有把图形库连接进去。
在TC中设置方法。Options-Linker-Graphics library.把它设置为on就行了。
另外,编译好后,程序只能在DOS下运行,因为它要控制硬件。不能在XP下的命令提示行下运行。