关于在C程序编译器下调用库函数的问题

shuqinshi5915 2017-10-24 12:44:37
我们在写排课系统软件的时候,从网上找了源代码,源码调用了<graphics.h>这个头文件,这是在很老的TC上编译才用到的头文件,所以报错为找不到这个头文件;于是我们在VC编译器中加入了easyX库,就只报错在46,47行,这个感觉很怪甚至感觉是语法错误的语句,但是修改了之后报错更多,所以来求助大神

目标:只要在VC或者codeblocks下能够运行即可,完整代码到网pan里了链接: https://pan.baidu.com/s/1hspdar6 密码: xtpphttps://pan.baidu.com/s/1hspdar6
[code=c]/*****************************************************************/
/* 课表排课系统 */
/*****************************************************************/

/*头文件*/
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<graphics.h>
/*宏定义*/
#define NULL 0
#define OK 1
#define ERROR -1
#define ESC 0x011b
#define TAB 0x0f09
#define ENTER 0x1c0d
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define BACKSPACE 0x0e08
#define SPACE 0x3920

/*结构体类型定义*/
struct weekday{
int wday;
char addr[5][10];
struct weekday *next;
};
struct course{
char cnumber[10];
char cname[10];
char period[10];
struct weekday *whead;
struct course *next;
};
struct person{
char pnumber[10];
char pname[10];
int pflag[7][5];
struct course *chead;
struct person *pro;
struct person *next;
};
/*****************************INPUT FUNCTION ****************************/
char* uscanf(sx,sy,max) /*图形模式下输入函数*/
int sx,sy,max;
{
int bsx=sx,bsy=sy,n;
int key,keylow;
char *p,*ch;
ch=p=(char*)malloc(sizeof(char)*100);
n=0;
do{
setcolor(RED);
line(sx,sy+15,sx+8,sy+15);
key=bioskey(0);
keylow=key & 0xff;
if(key==BACKSPACE && sx>bsx){ /*退格纠错处理*/
if(n!=max) sx-=8; p--;
setfillstyle(1,7);setcolor(7);
if(n==max) bar(sx,sy+3,sx+8,sy+16);
else bar(sx,sy+3,sx+16,sy+16);
n-=1;
}
else if(keylow>=48 && keylow<=57 || keylow>=65 && keylow<=90
|| keylow>=97 && keylow<=122 || key==SPACE) /*输入字符控制*/
if(n<max){
sprintf(p,"%c",keylow);
setfillstyle(1,7);setcolor(7);
bar(sx,sy+3,sx+8,sy+16);
setcolor(RED);
moveto(sx,sy+5); outtext(p);
n+=1;
p++;
sx+=8;
if(n==max) sx-=8;
}
}while(key!=ENTER && key!=TAB);
*p='/0';
setfillstyle(1,8); setcolor(8);
bar(bsx-1,bsy+1,bsx+68,bsy+17);
setcolor(7);
outtextxy(bsx,bsy+5,ch);
return(ch);
}/*uscanf*/
/******************************Function1***********************************/
void SETGRAPH(){ /*图形模式初始化*/
int driver,mode;
detectgraph(&driver,&mode);
initgraph(&driver,&mode,"");
}
void starting(){ /*开始界面*/
int i,times;
char ch='a';
char p[]={'W','/0','e','/0','l','/0','c','/0',
'o','/0','m','/0','e','/0','!','/0'};
setbkcolor(1);
setfillstyle(6,4);
floodfill(12,12,GREEN);
settextstyle(0,0,3); setcolor(14);
outtextxy(50,210,"Program Design Practise");
outtextxy(200,250,"Starting...");
setcolor(8); setlinestyle(1,0,THICK_WIDTH);
ellipse(320,240,0,360,318,239);
setfillstyle(1,8); delay(50000);
for(i=0;i<=360;i+=6){
delay(100);
sector(320,240,0,i,308,229);
}
setfillstyle(1,1); setcolor(2);
for(i=100;i<=350;i+=5){
delay(500);
bar3d(100,100,540,i,15,1);
}
settextstyle(0,0,4); setcolor(6);
outtextxy(150,130,"TIME-TABLE");
settextstyle(0,0,1); setcolor(12);
outtextxy(200,180,"time-table practice ver 1.0");
outtextxy(400,300,"DESIGNER:zzm");
times=0;
do{
settextstyle(0,0,3);
for(i=0;i<8;i++){
delay(3000);
setcolor(2+i+times%8);
outtextxy(220+i*25,220,&p[2*i]);
}
settextstyle(0,0,1);
outtextxy(300,260,"<Enter>");
times++;
if(times>2) ch=getch();
}while(ch!=0xd);
}/*starting*/
void end(){ /*退出界面*/
int i,times;
char p[]={'T','/0','H','/0','A','/0','N','/0',
'K','/0','-','/0','Y','/0','O','/0','U','/0'};
cleardevice();
setbkcolor(0);
setfillstyle(1,8); setcolor(1);
for(i=0;i<640;i+=5){
delay(100);
bar3d(0,100,i,350,0,1);
}
settextstyle(0,0,5); setcolor(YELLOW);
outtextxy(250,200,"END");
setfillstyle(1,1);
for(i=100;i<540;i+=4){
delay(200);
bar3d(100,100,i,350,0,1);
}
settextstyle(0,0,2); setcolor(6);
outtextxy(250,150,"TIME-TABLE");
settextstyle(0,0,1); setcolor(12);
outtextxy(220,180,"time-table practice ver 1.0");
outtextxy(280,300,"DESIGNER: ZhouZhiming");
times=0;
settextstyle(0,0,6);
do{
for(i=0;i<9;i++){
delay(3000);
setcolor(2+i+times%9);
outtextxy(125+i*45,220,&p[2*i]);
}
times++;
}while(times<2);
setfillstyle(1,0);setcolor(0);
for(i=0;i<640;i+=5){
delay(500);
bar3d(0,100,639,100+i,0,1);
bar3d(0,350-i,639,350,0,1);
}
closegraph();
exit(0);
}/*END*/

void box(sx,sy,ex,ey,depth,size,linecolor,fillcolor,fontcolor,p)
int sx,sy,ex,ey,linecolor,fillcolor;
char *p;
{ settextstyle(0,0,size);
setfillstyle(1,fillcolor);setcolor(linecolor);
bar3d(sx,sy,ex,ey,depth,1);
setcolor(fontcolor);
outtextxy(sx+5,(sy+ey)/2-5,p);
}/*box*/
char* index(){ /*主选择页面*/
int i;
int key,sx,sy,ex,ey,xincre,yincre;
char **p;
char *sp[]={"Infuse","Load","Save","Demand","Insert","Delete","Sort","Print","Exit"};
char *temp;
setcolor(1);
setfillstyle(6,8);
for(i=0;i<=180;i+=5){
delay(10);
sector(320,240,0,i,500,242);
sector(320,240,180,180+i,320,242);
}
setfillstyle(1,8);
for(i=0;i<=90;i+=5){
delay(10);
sector(210,240,0,i,150,200);
sector(210,240,90,90+i,150,200);
sector(210,240,180,180+i,100,200);
sector(210,240,270,270+i,200,200);
sector(430,240,0,i,150,200);
sector(430,240,90,90+i,150,200);
sector(430,240,180,180+i,200,200);
sector(430,240,270,270+i,200,200);
}
setfillstyle(1,1);
for(i=10;i<=70;i+=5){
delay(500);
bar3d(190,20,450,i,5,1);
}
settextstyle(0,0,3); setcolor(6);
outtextxy(200,30,"TIME-TABLE");
settextstyle(0,0,1); setcolor(12);
outtextxy(195,60,"Couse Schedule Supervise System");
setfillstyle(1,1); setcolor(1);
for(i=100;i<=380;i+=10){
delay(100);
bar3d(120,100,300,i,15,1);
bar3d(340,100,520,i,15,1);
}
settextstyle(0,0,2); setcolor(6);
outtextxy(150,120,"STUDENT'S");
outtextxy(370,120,"TEACHER'S");
for(i=0;i<9;i++){
box(180,158+i*20,240,176+i*20,5,1,2,2,LIGHTGREEN,sp[i]);
box(400,158+i*20,460,176+i*20,5,1,2,2,LIGHTGREEN,sp[i]);
}
sx=180;sy=158;ex=240;ey=176; xincre=0;yincre=0;
p=sp;
do{
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,RED,RED,YELLOW,*p);
key=bioskey(0);
switch(key){
case LEFT: if(xincre){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
xincre-=220;}
break;
case RIGHT: if(!xincre){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
xincre+=220;}
break;
case UP: if(yincre){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
p--;
yincre-=20;}
break;
case DOWN: if(yincre<160){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
p++;
yincre+=20; }
break;
case TAB: if(!xincre){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
xincre+=220;}
else if(yincre<160){
box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
xincre-=220; yincre+=20;
p++; }
else{ box(sx+xincre,sy+yincre,ex+xincre,ey+yincre,5,1,CYAN,CYAN,LIGHTGREEN,*p);
xincre=0; yincre=0; p=sp;}
break;
case ESC: end();
}
}while(key!=ENTER);
/* if(xincre) *p=strcat("Teachers-",*p);
else *p=strcat("Students-",*p);
return *p;
*/ /*WHY???*/
/*用上面的语句来替换下面语句的功能时,出现莫名其妙串连接情况*/
if(xincre){ if(strcmp(*p,"Infuse")==0) return "Teachers-Infuse";
else if(strcmp(*p,"Load")==0) return "Teachers-Load";
else if(strcmp(*p,"Save")==0) return "Teachers-Save";
else if(strcmp(*p,"Demand")==0) return "Teachers-Demand";
else if(strcmp(*p,"Insert")==0) return "Teachers-Insert";
else if(strcmp(*p,"Delete")==0) return "Teachers-Delete";
else if(strcmp(*p,"Sort")==0) return "Teachers-Sort";
else if(strcmp(*p,"Print")==0) return "Teachers-Print";
else if(strcmp(*p,"Exit")==0) return "Teachers-Exit";
}
else { if(strcmp(*p,"Infuse")==0) return "Students-Infuse";
else if(strcmp(*p,"Load")==0) return "Students-Load";
else if(strcmp(*p,"Save")==0) return "Students-Save";
else if(strcmp(*p,"Demand")==0) return "Students-Demand";
else if(strcmp(*p,"Insert")==0) return "Students-Insert";
else if(strcmp(*p,"Delete")==0) return "Students-Delete";
else if(strcmp(*p,"Sort")==0) return "Students-Sort";
else if(strcmp(*p,"Print")==0) return "Students-Print";
else if(strcmp(*p,"Exit")==0) return "Students-Exit";
}
}/*index*/
void rebkground(){ /*背景恢复*/
int i;
setfillstyle(6,4); setlinestyle(0,0,THICK_WIDTH);setcolor(8);
for(i=0;i<=60;i+=5){
sector(320,240,0,i,600,300); sector(320,240,60,60+i,600,300);
sector(320,240,120,120+i,600,300); sector(320,240,180,180+i,600,300);
sector(320,240,240,240+i,600,300); sector(320,240,300,300+i,600,300);
}
setlinestyle(0,0,NORM_WIDTH);
}/*rebkground*/
/***********************************Function 2******************************/
...全文
347 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
开心秋水 2017-10-29
  • 打赏
  • 举报
回复
'/0'改为'\0'
热血打工人 2017-10-28
  • 打赏
  • 举报
回复
下载easyx并安装。
ckc 2017-10-28
  • 打赏
  • 举报
回复
这个是以前的turbo c用的图形库体系,在dos下用的 到了今天肯定没用了 在这上面改也没什么意义,这代码也就只能给我们这些老人怀怀旧了
赵4老师 2017-10-26
  • 打赏
  • 举报
回复
引用 6 楼 goldenhawking 的回复:
赵老师太厉害了!这个http://www.easyx.cn太棒了!这样我的好多老程序,可以脱离虚拟机啦!
Who am I!
陪妳看星星 2017-10-26
  • 打赏
  • 举报
回复
引用 9 楼 zhao4zhong1 的回复:
请教该技术对应的源代码或汇编指令。 不要迷信书、考题、老师、回帖; 要迷信CPU、编译器、调试器、运行结果。 并请结合“盲人摸太阳”和“驾船出海时一定只带一个指南针。”加以理解。 任何理论、权威、传说、真理、标准、解释、想象、知识……都比不上摆在眼前的事实!
难道已经没有人类可以在技术上指导赵老师了?好厉害
赵4老师 2017-10-26
  • 打赏
  • 举报
回复
引用 8 楼 u010312274 的回复:
[quote=引用 7 楼 zhao4zhong1 的回复:] [quote=引用 6 楼 goldenhawking 的回复:] 赵老师太厉害了!这个http://www.easyx.cn太棒了!这样我的好多老程序,可以脱离虚拟机啦!
Who am I![/quote] 赵老师骄傲了哈 话说赵老师遇到技术问题能请教谁?[/quote] 请教该技术对应的源代码或汇编指令。 不要迷信书、考题、老师、回帖; 要迷信CPU、编译器、调试器、运行结果。 并请结合“盲人摸太阳”和“驾船出海时一定只带一个指南针。”加以理解。 任何理论、权威、传说、真理、标准、解释、想象、知识……都比不上摆在眼前的事实!
陪妳看星星 2017-10-26
  • 打赏
  • 举报
回复
引用 7 楼 zhao4zhong1 的回复:
[quote=引用 6 楼 goldenhawking 的回复:] 赵老师太厉害了!这个http://www.easyx.cn太棒了!这样我的好多老程序,可以脱离虚拟机啦!
Who am I![/quote] 赵老师骄傲了哈 话说赵老师遇到技术问题能请教谁?
  • 打赏
  • 举报
回复
赵老师太厉害了!这个http://www.easyx.cn太棒了!这样我的好多老程序,可以脱离虚拟机啦!
shuqinshi5915 2017-10-25
  • 打赏
  • 举报
回复
能编译通过的可以再开贴加100分
shuqinshi5915 2017-10-25
  • 打赏
  • 举报
回复
加了void还是不能编译通过诶,报错有很多未声明的变量
赵4老师 2017-10-24
  • 打赏
  • 举报
回复
wang0635 2017-10-24
  • 打赏
  • 举报
回复
修改函数定义的方式 把 char* uscanf(sx,sy,max) /*图形模式下输入函数*/ int sx,sy,max; {...} 改成 char* uscanf(int sx,int sy,int max) /*图形模式下输入函数*/ {...} 把 void SETGRAPH(){ /*图形模式初始化*/ 改成 void SETGRAPH(void){ /*图形模式初始化*/ 之类。 上个世纪八十年代的代码,现在的编译器快不认识它们了
天台的故事 2017-10-24
  • 打赏
  • 举报
回复

70,023

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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