[c]代码库
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define OK 1
#define TRUE 1
#define FALSE 0
#define ERROR 0
#define OVERFLOW -2
#define PR printf
typedef int status;
typedef struct airline{
char line_num[8];//航班号
char plane_num[8];//飞机号
char end_place[20];//目的的
int total;//座位总数
int left;//剩余座位
struct airline *next;//下一个结点
}airline;
typedef struct customer{
char name[9];//顾客名
char line_num[8];//航班号
int seat_num;//座位号
struct customer *next;//下一个结点
}customer;
airline *init_airline(){//初始化链表
airline *l;
l=(airline*)malloc(sizeof(airline));
if(l==NULL){
exit(0);
}
l->next=NULL;
return l;
}
customer * init_customer(){//初始化链表
customer *l;
l=(customer*)malloc(sizeof(customer));
if(l==NULL){
exit(0);
}
l->next=NULL;
return l;
}
status insert_airline(airline **p,char *line_num,char *plane_num,char *end_place,int total,int left){//airline链表插入操作
airline *q;
q=(airline*)malloc(sizeof(airline));
strcpy(q->line_num , line_num);
strcpy(q->plane_num , plane_num);
strcpy(q->end_place , end_place);
q->total =total;
q->left =left;
q->next=NULL;
(*p)->next=q;
(*p)=(*p)->next;
// PR("insert %d ,%dis succssed!\n",e,bl);
return OK;
}
[源代码打包下载]
中级程序员
by: 未了 发表于:2019-10-17 10:41:14 顶(0) | 踩(0) 回复
地方
回复评论