火车票管理系统程序设计
编译时出现了一些问题,哪位大哥来帮帮我吧。
Compiling...
xx.c
C:\Users\Administrator\Desktop\xx\xx.c(24) : warning C4013: 'printf' undefined; assuming extern returning int
C:\Users\Administrator\Desktop\xx\xx.c(33) : fatal error C1083: Cannot open include file: 'node.h': No such file or directory
Error executing cl.exe.
xx.obj - 1 error(s), 1 warning(s)
源代码如下(百度文库里的)
#ifndef _NODE_H_
#define _NODE_H_
struct Train_Information
{
char TrainNum[15];
char StartTime[20];
char StartPlace[20];
char EndPlace[20];
char TimeCost[15];
int LNP; //额定载量
int tickets;
};
typedef struct Train_Information Type;
const int sizeInfo=sizeof(Type);
struct node
{
Type data;
struct node *next;
};
const int size=sizeof(struct node);
void showstar()
{
printf("*************************************************\n");
}
#endif
#ifndef _LIST_H_
#define _LIST_H_
#include <string.h>
#include <time.h>
#include "node.h"
char tbuffer[9];
struct node* Delete(struct node* head); //根据姓名删除班车表中某车次所有信息
struct node* Insertafter(struct node* head,Type data); //读入后后插法建链
int printeverybody(struct node* head); //打印班车表
struct node* Addone(struct node* head); //添加车次
struct node* Edit(struct node* head); //编辑修改车次信息
struct node* SortST(struct node* head); //发车时间排序函数
struct node* SearchTic(struct node* head); //查询售票情况
struct node* SellTic(struct node* head); //售退票函数
void saveFileSort(struct node* head)
{
struct node *p=head;
FILE *fp;
if((fp=fopen("sort.dat","w"))==NULL)
{
printf("打不开\n");
exit(0);
}
if(head==NULL)
{
printf("没东西。。存不了!!");
return;
}
while(p)
{
fprintf(fp,"%s%s%s%s%s%d%d",(p->data).TrainNum,(p->data).StartTime,(p->data).StartPlace,(p->data).EndPlace,(p->data).TimeCost
,(p->data).LNP,(p->data).tickets);
p=p->next;
}
fclose(fp);
}
struct node* Delete(struct node* head)
{
if(head==NULL)
{
printf("没东西。。删除不起来!!");
return head;
}
getchar();
char p[30];
printf("请输入您要删除的车次:\n");
gets(p);
struct node *a=head,*b=NULL;
if(head==NULL)
{
printf("\n班车表中没有数据\n");
return head;
}
while(a&&strcmp(p,(a->data).TrainNum))
{
b=a;
a=a->next;
}
if(a)
{
if(b)
b->next=a->next;
else
head=head->next;
free(a);
printf("已经删除该车次的所有信息。\n\n\n");
}
else
printf("\n您所查找车次不在班车表中\n\n\n");
return head;
}
struct node* Insertafter(struct node* head,Type x)
{
struct node *p,*p1;
p=(struct node*)malloc(size);
p->data=x;
p->next=NULL;
if(head==NULL)
{
head=p;
return head;
}
p1=head;
while(p1->next)
{
p1=p1->next;
}
p1->next=p;
return head;
}
struct node* Addone(struct node* head)
{
struct node *p,*p1;
p=(struct node*)malloc(size);
printf("请输入车次号\n");
scanf("%s",(p->data).TrainNum);
printf("请输入起始时间\n");
scanf("%s",(p->data).StartTime);
printf("请输入发车地点\n");
scanf("%s",(p->data).StartPlace);
printf("请输入到达地点\n");
scanf("%s",(p->data).EndPlace);
printf("请输入行驶时间\n");
scanf("%s",(p->data).TimeCost);
printf("请输入额定载量\n");
scanf("%d",&(p->data).LNP);
printf("请输入可售票数量\n");
scanf("%d",&(p->data).tickets);
p->next=NULL;
if(head==NULL)
{
head=p;
return head;
}
p1=head;
while(p1->next)
{
p1=p1->next;
}
p1->next=p;
printf("********************\n");
printf(" 插入成功\n");
printf("********************\n");
return head;
}
struct node* Edit(struct node* head)
{
int choice;
getchar();
char p[30];
printf("请输入您要修改的车次号:\n");
gets(p);
struct node *a=head,*b=NULL;
if(head==NULL)
{
printf("\n班车表中没有数据\n");
return head;
}
while(a&&strcmp(p,(a->data).TrainNum))
{
b=a;
a=a->next;
}
if(a)
{
printf("请选择您要求更改的项:\n");
printf("--------1.车次号-------------\n");
printf("--------2.起始时间-----------\n");
printf("--------3.发车地点-----------\n");
printf("--------4.到达地点-----------\n");
printf("--------5.行驶时间-----------\n");
printf("--------6.额定载量-----------\n");
printf("--------7.余票量-------------\n");
printf("--------0.不改了-------------\n");
scanf("%d",&choice);
switch(choice)
{
case 1: printf("车次号:"); scanf("%s",(a->data).TrainNum); break;
case 2: printf("起始时间:"); scanf("%s",(a->data).StartTime); break;
case 3: printf("发车地点:"); scanf("%s",(a->data).StartPlace); break;
case 4: printf("到达地点:"); scanf("%s",(a->data).EndPlace); break;
case 5: printf("行驶时间:"); scanf("%s",(a->data).TimeCost); break;
case 6: printf("额定载量:"); scanf("%d",&(a->data).LNP); break;
case 7: printf("余票量:"); scanf("%d",&(a->data).tickets); break;
case 0: break;
}
printf("搞定!\n");
}
else
printf("\n您所查找的车次不在班车表中\n\n\n");
return head;
}