軟件課程設(shè)計C語言設(shè)計火車票訂票系統(tǒng)之源代碼模擬數(shù)據(jù)庫功能需求分析 可行性分析
軟件課程設(shè)計--C語言設(shè)計火車票訂票系統(tǒng)之源代碼(模擬數(shù)據(jù)庫功能)(需求分析+可行性分析)
設(shè)計題目:火車訂票系統(tǒng)
小組成員:
指導(dǎo)教師:
完成時間:
一.需求設(shè)計:
1.每條線路所涉及的信息有:起點、終點、站名、車次、、票價、時間、座位號。
2.作為示意系統(tǒng),全部數(shù)據(jù)可以只放在內(nèi)存中。
3.系統(tǒng)能實現(xiàn)的功能和操作如下:
①.查詢路線:根據(jù)旅客提出的終點站名輸入下列信息:車次、車站名。
②.承辦訂票業(yè)務(wù):根據(jù)客戶提出的要求查詢該車次票額的情況,若尚有余票,則為客戶辦理訂票手續(xù),輸出座位號;若已滿員或余票額少于訂票額,則需重新查詢客戶要求,若需要可登記排隊候補(bǔ)。
③.承辦退票業(yè)務(wù):根據(jù)客戶提供的情況(車次、時間、座位號)為客戶辦理退票手續(xù),然后查詢該車次是否有人排隊候補(bǔ),首先詢問排在第一的客戶,若所退票額能滿足他的要求,則為他辦理訂票手續(xù),否則依次詢問其他排隊候補(bǔ)的客戶。
④登記旅客情況:包括旅客姓名,性別,年齡,家庭住址,聯(lián)系方式等。
⑤統(tǒng)計功能:將每次車的訂票,退票結(jié)果統(tǒng)計出來。
⑥管理功能:列車管理員可以通過調(diào)用函數(shù)來查看車票極其用戶情況.
⑦.查詢功能:用戶可以查詢自己需要的車輛信息.
二.總體設(shè)計
1.程序流程圖:
按1鍵
按2鍵
按3鍵
按4鍵
進(jìn)入in函數(shù)
進(jìn)入book函數(shù)
進(jìn)入inquire函數(shù)
進(jìn)入cancel函數(shù)
按5鍵
進(jìn)入you函數(shù)
2.總體設(shè)計說明:
①.數(shù)據(jù)結(jié)構(gòu)設(shè)計:
程序=數(shù)據(jù)結(jié)構(gòu)+算法,一個好的程序必定有一個好的數(shù)據(jù)結(jié)構(gòu).本設(shè)計主要考慮車票信息和用戶信息的數(shù)據(jù)結(jié)構(gòu).
車票信息采用半十字鏈表.橫向鏈表中的每一個結(jié)點包含以下內(nèi)容:車次,起始站,發(fā)車時間,指向下一個結(jié)點的指針,指向中途站的指針.縱向鏈表中每一個結(jié)點包含以下內(nèi)容:從始發(fā)站開始的依次到站,票價,到達(dá)時間,是否已被購買標(biāo)識,才用mark標(biāo)識,當(dāng)mark為1時車票已售出,當(dāng)mark為0時車票還未售出.以及指向下一個結(jié)點的指針.縱向鏈表采用循環(huán)鏈表,尾指針指向首指針.
未購票用戶信息使用隊列來保存,因為考慮到用戶會預(yù)訂票,所以把用戶以來訂票的時間早晚排在隊中.先來先買,后來后買.隊列中的每個元素包含以下內(nèi)容:用戶姓名,身份證號碼,想要購票的車次,起始站,要到的站,時間.
已經(jīng)購票用戶信息使用一個單鏈表來保存,鏈表中的沒個結(jié)點包含以下內(nèi)容:用戶姓名,身份證號碼,已購車票的車次,出發(fā)時間,到達(dá)時間.
車票信息鏈表示意圖:
車次
起始站
發(fā)車時間
downn
next
下一站名
到站時間
票價
mark
next
座位號
未購票用戶信息隊列:
用戶姓名
購票的車次
起始站
要到的站
達(dá)到時間
用戶姓名
購票的車次
起始站
要到的站
達(dá)到時間
注:座位號包含在車次號中
已購票用戶信息鏈表示意圖:
用戶姓名
身份證號碼
已購車票的車次號
出發(fā)時間
到達(dá)時間
注:座位號包含在車次號中
②算法的設(shè)計:
主函數(shù):
利用case語句實現(xiàn)用戶界面,用戶輸入需要的服務(wù)的數(shù)字代碼,程序就會轉(zhuǎn)到相應(yīng)的函數(shù),實現(xiàn)相應(yīng)的功能。在主函數(shù)開始處做下First標(biāo)識,以便在其他函數(shù)中使用goto語句返回主函數(shù)的用戶界面。
In()函數(shù):
In()函數(shù)負(fù)責(zé)輸入各種信息,鏈表中車票信息的初始值.
Book()函數(shù):
Book()函數(shù)負(fù)責(zé)訂票功能.主要是遍歷整個鏈表,查找到需要訂票的結(jié)點后修改其mark值.
Inquire()函數(shù):
Inquire()函數(shù)主要負(fù)責(zé)查詢功能.主要是遍歷整個鏈表查找到需要的結(jié)點,然后輸出.
Cancel()函數(shù):
Cancel()函數(shù)主要負(fù)責(zé)退票功能.主要是遍歷整個鏈表查找到需要的結(jié)點,然后修改mark的值.
You()函數(shù):
You()函數(shù)主要負(fù)責(zé)輸入用戶信息,主要是創(chuàng)建一個單鏈表,將用戶信息放入.并提供管理人員的查詢功能.
Find()函數(shù):
Find()函數(shù)主要負(fù)責(zé)查詢用戶信息,遍歷整個單鏈表后,輸出需要的信息.
Total()函數(shù):
Total()函數(shù)主要負(fù)責(zé)統(tǒng)計整個訂票系統(tǒng)的情況.
三.詳細(xì)設(shè)計:
1. 主函數(shù):
①程序代碼:
Main()
{ int *t;
int c;
First: printf(“welcome to our ticket system!\n”);
printf(“1.intput the data.\n”); /*按1鍵輸入數(shù)據(jù)*/
printf(“2.book the ticket.\n”); /*按2鍵訂車票*/
printf(“3.inquire the ticket.\n”); /*按3鍵查詢車票*/
printf(“4.cancel the ticket.\n”); /*按4鍵退車票*/
printf(“5.input your own data.\n”); /*按5鍵輸入個人信息*/
scanf(“%d”,&c);
switch(c)
{case ‘1’: t=in(); break;
case ‘2’: book(); break;
case ‘3’: inquire(); break;
case ‘4’: cancel(); break;
case ‘5’: you() ; break;
default : printf(“you enter an error number\n”);}}
②功能說明:
通過printf語句,輸出提示用戶選擇的信息.用戶看到后,按下自己需要功能的代號.然后程序進(jìn)入實現(xiàn)該功能函數(shù)完成用戶所需要的功能.
2. In()函數(shù):
①程序流程圖:
建立橫向鏈表頭結(jié)點
輸入m,n的值
For循環(huán),m是否為0
否
建立結(jié)點
向結(jié)點輸入數(shù)據(jù)
For循環(huán),n是否為0
否
建立縱向結(jié)點
向結(jié)點輸入數(shù)據(jù)
是
返回頭指針
Goto到用戶界面
②程序代碼:
struct ticket *in() /*一個返回指針形的函數(shù)*/
{
struct ticket *head; /*頭結(jié)點*/
struct ticket *p1,*p2;
struct station *s1,*s2;
int m,n;
int i;
p1=p2=(struct ticket *)malloc(len); /*建立橫向鏈表的頭結(jié)點*/
scanf("%d",&m); /*輸入一共所需的車票信息總數(shù)*/
scanf(“%d”,&n); /*輸入從始發(fā)站到終點站共有幾站*/
head=null;
for(i=0;i<=m;i++)
{
p2->next=p1;
p2=p1;
p1=(struct ticket )*malloc(len);
s1=s2=(struct ticket )*malloc(len); /*建立縱向鏈表的頭結(jié)點*/
head1=s1=s2;
p1->down=s1=s2; /*指向縱向鏈表的頭結(jié)點*/
scanf("%d","%d","%d",&p1->num,&p1->num2, &p1->time); /*輸入橫向鏈表的數(shù)據(jù)*/
for(i=0;i<=n,i++)
{
s2->next=s2;
s2=s1;
s1=(struct ticket )*malloc(len); /*建立縱向鏈表*/
scanf(“%s”,“%d”,“%d”,“%d”,“%d”,s1->name,&s1->time,&s1->money,&s1->seat,&s1->mark);
} /*輸入縱向鏈表的數(shù)據(jù)*/
s1->next=head1; /*縱向鏈表為循環(huán)鏈表*/
}
p2->next=null;
return(head); /*返回頭指針*/
goto first; /*返回頭指針*/
}
③功能說明:
通過用戶輸入的數(shù)值,建立所需的結(jié)點數(shù)量.再輸入每個結(jié)點的具體數(shù)據(jù).使橫向鏈表的尾指針指向空,縱向鏈表的的尾指針指向頭指針.最后返回頭指針,再回到用戶界面.
3.Book()函數(shù):
①程序流程圖:
輸入需要的車次號
輸入需要到達(dá)的車站名
While循環(huán)是否需要的車次
是
橫向結(jié)點值給o
While循環(huán)是否是需要的車站名
是
使mark的值為1
縱向結(jié)點值給s
縱向鏈表移針
橫向鏈表移針
當(dāng)橫向鏈表下一個指針為空時
輸出 s點的數(shù)據(jù)
輸出 o點的數(shù)據(jù)
Mark是否為1
錯誤
否
是
②程序代碼:
void book()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number==t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name==h)
{
if (q->mark=1)
printf(“your ticket is unused”);
else
q->mark=1; /*修改mark標(biāo)記*/
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}}
p=p->next; /*橫向鏈表移針*/
}
printf(“your ticket has already booked!”);
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
③功能說明:
本函數(shù)主要是先遍歷橫向鏈表找到符合條件的結(jié)點后,轉(zhuǎn)向該點的縱向鏈表,遍歷縱向鏈表找到符合條件的結(jié)點,讀出需要的數(shù)據(jù).并且修改mark標(biāo)記,使其成為已定車票.如果mark已經(jīng)為1則輸出錯誤信息.
3.inquire()函數(shù):
①程序流程圖:
輸入需要的車次號
輸入需要到達(dá)的車站名
While循環(huán)是否已到空
否
是否是需要的車次
是
While循環(huán)是否已到頭指針
否
是否是需要的車站名
是
輸出所需的信息
是
是
錯誤
移動指針
否
否
②程序代碼:
void inquire()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number==t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name==h)
{
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}
}
p=p->next; /*橫向鏈表移針*/
}
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
③功能說明:
本函數(shù)主要提供查詢功能.用戶輸入需要查詢的車次和需要到 車站名,程序首先遍歷橫向鏈表查找到需要的數(shù)據(jù)后轉(zhuǎn)向縱向鏈表,接著遍歷縱向鏈表,查找到需要的車站名.最后輸出所有關(guān)于本車次的所有信息.
4.Cancel()函數(shù):
①程序流程圖:
輸入需要的車次號
輸入需要到達(dá)的車站名
While循環(huán)是否需要的車次
是
橫向結(jié)點值給o
While循環(huán)是否是需要的車站名
是
使mark的值為0
縱向結(jié)點值給s
縱向鏈表移針
橫向鏈表移針
當(dāng)橫向鏈表下一個指針為空時
輸出 s點的數(shù)據(jù)
輸出 o點的數(shù)據(jù)
②程序代碼;
void cancel()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number=t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name=h)
{
q->mark=0; /*修改mark標(biāo)記*/
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}}
p=p->next; /*橫向鏈表移針*/
}
printf(“your ticket has already cancel!”);
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
③功能說明:
本函數(shù)主要提供退票功能.用戶輸入需要退票的車次和需要到車站名,程序首先遍歷橫向鏈表查找到需要的數(shù)據(jù)后轉(zhuǎn)向縱向鏈表,接著遍歷縱向鏈表,查找到需要的車站名.修改其mark標(biāo)識是其為0.最后輸出所有關(guān)于本車次的所有信息.
5. You()函數(shù):
①程序代碼:
void you()
{
struct you *head;
struct you *p;
p=(struct you *)malloc(len);
scanf("%d",&p->name,&p->num,&p->num1,&p->time,&p->time1);
}
goto First;
}
②用戶查詢代碼: (注:本函數(shù)用于管理人員查詢用戶)
void find()
{
struct you *head;
struct you *p;
int u;
scanf(“%d”,&u);
while(p=!null)
{
if(p->num=u)
{s=p;}
p=p->next;
}
printf(“%s”,”%d”,”%d”,”%d”,”%d”,p->name,p->num,p->num1,p->time,p->time1);
}
③功能說明:
本函數(shù)用于用戶輸入個人信息,以便管理人員管理.而管理函數(shù)只面對管理人員使用,因此未在用戶界面上顯示出來.
6.統(tǒng)計模塊:
void total()
{
int *p,*q;
int n;
p=t;
while(p=!null)
{
while(q->next=!head1)
{
if (mark=1)
{n=n+1;}
q=q->next;
}
p=p->next;
}
printf(“the number of the booked ticket are :”);
printf(“%d”,n);
}
6.所用變量聲明:
①橫向鏈表結(jié)點的結(jié)構(gòu)體:
struct ticket
{
int num;
int num1;
int time;
struct ticket *next;
struct station *down;
};
int t;
②縱向鏈表結(jié)點的結(jié)構(gòu)體:
struct station
{
int name;
int time;
int money;
int mark;
struct station *next;
}
③用戶信息鏈表結(jié)點的結(jié)構(gòu)體:
struct you
{
int name;
int num;
int num1;
int time;
int time1;
struct you *next;
}
四.程序說明書:
本系統(tǒng)用于火車站的車票管理.主要方便用戶訂票,也可方便管理人員管理車票.當(dāng)用戶看到用戶界面時,可以根據(jù)提示選擇自己想要的服務(wù),選擇后按下回車鍵,程序便會轉(zhuǎn)到相應(yīng)的函數(shù)進(jìn)行.完成后,程序會顯示您已經(jīng)成功的訂票或退票.完成后程序會自動回到起始位置.
管理人員也可以很方便的調(diào)用本系統(tǒng)包含的查詢和統(tǒng)計函數(shù),管理車票情況.
具體說明:
1.提示程序操作者輸入預(yù)設(shè)的數(shù)據(jù).
2.提示用戶進(jìn)行訂票操作.
3.提示用戶進(jìn)行查詢自己需要的車票的操作.
4.提示用戶進(jìn)行退票操作.
5.提示用戶輸入自己的相關(guān)信息.
五.程序調(diào)試:
本程序分為多模塊,為的是方便小組合作.所以各個功能都由函數(shù)調(diào)用來實現(xiàn).組員在各自的編制和調(diào)試中基本都實現(xiàn)所需的功能.但在聯(lián)調(diào)的過程中,由于我們使用了大量的傳遞指針形的函數(shù),所以在數(shù)值的傳遞上問題很多.分步執(zhí)行的時候指針的位置很亂!所以讓我們遺憾的是聯(lián)調(diào)并沒有成功.我們也會吸取教訓(xùn),在函數(shù)編制時注意數(shù)值的傳遞.
六.運行結(jié)果:
輸入: 2
3
K717,Beijing,11:00
Yuci,12:00,10,0,56
Yangyuan,1:00,20,0,56
Shijiazhuang,2:00,30,56
輸入:k717
shijiazhuang
輸出:you have already booked the ticket!
K717,shijiazhuang,11:00,3:00,30,56
七.程序源代碼:
#include <stdio.h>
#include <string.h>
#define null 0
#define len sizeof(struct ticket)
struct ticket
{
int num;
int num1;
int time;
struct ticket *next;
struct station *down;
};
int t;
struct station /*公共變量聲明*/
{
int name;
int time;
int money;
int mark;
struct station *next;
struct you
{
int name;
int num;
int num1;
int time;
int time1;
struct you *next;
}
struct ticket *in() /*一個返回指針形的函數(shù)*/
{
struct ticket *head; /*頭結(jié)點*/
struct ticket *p1,*p2;
struct station *s1,*s2;
int m,n;
int i;
p1=p2=(struct ticket *)malloc(len); /*建立橫向鏈表的頭結(jié)點*/
scanf("%d",&m); /*輸入一共所需的車票信息總數(shù)*/
scanf(“%d”,&n); /*輸入從始發(fā)站到終點站共有幾站*/
head=null;
for(i=0;i<=m;i++)
{
p2->next=p1;
p2=p1;
p1=(struct ticket )*malloc(len);
s1=s2=(struct ticket )*malloc(len); /*建立縱向鏈表的頭結(jié)點*/
head1=s1=s2;
p1->down=s1=s2; /*指向縱向鏈表的頭結(jié)點*/
scanf("%d","%d","%d",&p1->num,&p1->num2, &p1->time); /*輸入橫向鏈表的數(shù)據(jù)*/
for(i=0;i<=n,i++)
{
s2->next=s2;
s2=s1;
s1=(struct ticket )*malloc(len); /*建立縱向鏈表*/
scanf(“%s”,“%d”,“%d”,“%d”,“%d”,s1->name,&s1->time,&s1->money,&s1->seat,&s1->mark);
} /*輸入縱向鏈表的數(shù)據(jù)*/
s1->next=head1; /*縱向鏈表為循環(huán)鏈表*/
}
p2->next=null;
return(head); /*返回頭指針*/
goto first; /*返回頭指針*/
}
void book()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number==t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name==h)
{
if (q->mark=1)
printf(“your ticket is unused”);
else
q->mark=1; /*修改mark標(biāo)記*/
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}}
p=p->next; /*橫向鏈表移針*/
}
printf(“your ticket has already booked!”);
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
void inquire()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number==t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name==h)
{
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}
}
p=p->next; /*橫向鏈表移針*/
}
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
void cancel()
{
struct ticket *p;
struct station *q;
int t;
int *o,*s;
printf(“please enter the number:”);
scanf(“%d”,&f); /*輸入需要的車次*/
printf(“please enter the station:”);
scanf(“%d”,&h); /*輸入需要到達(dá)的車站名*/
p=t; /*初始化p的值*/
while(p=!null)
{
if(p->number=t)
{ q=p->down;
o=p; /*把符合條件的橫向鏈表結(jié)點的數(shù)據(jù)給o*/
while(q->next=!head1)
{
if(q->name=h)
{
q->mark=0; /*修改mark標(biāo)記*/
s=q; /*把符合條件的縱向鏈表的數(shù)據(jù)給s*/
}
q=q->next; /*縱向鏈表移針*/
}}
p=p->next; /*橫向鏈表移針*/
}
printf(“your ticket has already cancel!”);
printf("%d","%d","%d",o->num,o->num2, o->time); /*輸出橫向鏈表的數(shù)據(jù)*/
printf(“%s”,“%d”,“%d”,“%d”,“%d”,s->name,&s->time,&s->money,&s->seat,&s->mark); /*輸出縱向鏈表的數(shù)據(jù)*/
goto first;
}
void you()
{
struct you *head;
struct you *p;
p=(struct you *)malloc(len);
scanf("%d",&p->name,&p->num,&p->num1,&p->time,&p->time1);
}
goto First;
}
void find()
{
struct you *head;
struct you *p;
int u;
scanf(“%d”,&u);
while(p=!null)
{
if(p->num=u)
{s=p;}
p=p->next;
}
printf(“%s”,”%d”,”%d”,”%d”,”%d”,p->name,p->num,p->num1,p->time,p->time1);
}
void total()
{
int *p,*q;
int n;
p=t;
while(p=!null)
{
while(q->next=!head1)
{
if (mark=1)
{n=n+1;}
q=q->next;
}
p=p->next;
}
printf(“the number of the booked ticket are :”);
printf(“%d”,n);
}
Main()
{ int *t;
int c;
First: printf(“welcome to our ticket system!\n”);
printf(“1.intput the data.\n”); /*按1鍵輸入數(shù)據(jù)*/
printf(“2.book the ticket.\n”); /*按2鍵訂車票*/
printf(“3.inquire the ticket.\n”); /*按3鍵查詢車票*/
printf(“4.cancel the ticket.\n”); /*按4鍵退車票*/
printf(“5.input your own data.\n”); /*按5鍵輸入個人信息*/
scanf(“%d”,&c);
switch(c)
{case ‘1’: t=in(); break;
case ‘2’: book(); break;
case ‘3’: inquire(); break;
case ‘4’: cancel(); break;
case ‘5’: you() ; break;
default : printf(“you enter an error number\n”);
}
}