火车票订票系统

  • 格式:docx
  • 大小:38.45 KB
  • 文档页数:12

下载文档原格式

  / 12
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include//预处理函数

#include//标准库函数

#include//字符串函数

#include//通过键盘来控制程序调试

int o=0;

typedef struct zuowei

{

int a;//车座

int b;//车厢

}seat;

typedef struct Tmess{//定义一个结构体存储火车订票的信息char tnum[8];//火车车次

char time1[8];//发车时间

char station1[8];//出发站

char station2[8];//终点站

char tujingstation[8];//途经站

char time2[8];//到站时间

char money[5];//票价

}tmess;

typedef struct in{//定义一个结构体存储火车座位信息tmess data;//调用火车的信息

int reseat;//剩余票

seat seatnum;

struct in *next;//定义next指针

}in;

typedef struct pmess{//定义一个结构体存储乘客信息char name[10];//姓名

char tel[15];//电话

char id[20];//身份证

char booknum[3];//订票数目

char checi[8];//车次

}pmess;

typedef struct people{//乘客信息

pmess m;//调用pmess结构体

struct people *next;//定义next指针

}people;

struct dingdan{

int danhao;

char tnum[8];//火车车次

char time1[8];//发车时间

char station1[8];//出发站

char station2[8];//终点站

char tujingstation[8];//途经站

char time2[8];//到站时间

char money[5];

char name[10];//姓名

char tel[15];//电话

char id[20];//身份证

char booknum[3];//订票数目

char seat[10];

char seatnum[10];

}dingdan[100];

void end();

void admin();

void book(in *h,people *k);

void cancel();

void chaxuntrain(in *h);

in *fangshi(in *h,char findmess[],char numorcity[]); void print();

void passenger();

void putoutticket(in *p);

void putticket(in *h);

void widows();

int main()

{

for(int i=0;i<100;i++)

{dingdan[i].danhao=i+1000;

}

in *h,*p;

people *k,*v;

int wp;

h=(in*)malloc(sizeof(in));

h->next=NULL;

k=(people*)malloc(sizeof(people));

k->next=NULL;

p=h;

v=k;

while(1)

{

system("cls");

widows();

scanf("%d",&wp);

fflush(stdin);

system("cls");

switch(wp)

{

case 1:

putticket(h);break;

case 2:

chaxuntrain(p);break;

case 3:

book(p,v);break;

case 4:

print();break;

case 5:

cancel();break;

default:break;

}

printf("\n请按任何键结束\n");

getch();

}

return 0;

}

void end()

{//结束页面函数

puts("********************************************");

printf(" 谢谢使用\n");

}

void widows()

{//初始页面函数;

printf("*****************************************************************************\ n");

printf(" * # * \n");

printf(" * @@ # * \n");

printf(" * @@@@ # * \n");

printf(" * @@@@@@ # *\n");

printf(" * ##################### * \n");

printf(" * ################# *\n");

printf(" *############# *\n");

printf(" * ########### *\n");

printf(" * ####### *\n");

printf(" * ### *\n");

printf(" *# ☆1,输入车次信息 * \n");

printf(" *# ☆2,查询车次 * \n");

printf(" *# ☆3,订票 * \n");

printf(" *# ☆4,订单查询 * \n");

printf(" *# ☆5,退票 *\n");

printf(" *# ☆6,退出系统 * \n");

printf(" * ############ *\n");

printf("*****************************************************************************\ n");

printf(" 请输入选择:");

}

void putticket(in *h)

{//输入车次信息

in *p,*l,*s;//定义了三个指针变量

char num[8];//定义了数组

p=h;//p指向尾节点

l=h->next;//l指针遍历火车信息

while(p->next)

{

p=p->next;

}