C++语言毕业课程设计报告长途客运订票系统.docx

上传人:b****7 文档编号:9658282 上传时间:2023-02-05 格式:DOCX 页数:18 大小:18.52KB
下载 相关 举报
C++语言毕业课程设计报告长途客运订票系统.docx_第1页
第1页 / 共18页
C++语言毕业课程设计报告长途客运订票系统.docx_第2页
第2页 / 共18页
C++语言毕业课程设计报告长途客运订票系统.docx_第3页
第3页 / 共18页
C++语言毕业课程设计报告长途客运订票系统.docx_第4页
第4页 / 共18页
C++语言毕业课程设计报告长途客运订票系统.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

C++语言毕业课程设计报告长途客运订票系统.docx

《C++语言毕业课程设计报告长途客运订票系统.docx》由会员分享,可在线阅读,更多相关《C++语言毕业课程设计报告长途客运订票系统.docx(18页珍藏版)》请在冰豆网上搜索。

C++语言毕业课程设计报告长途客运订票系统.docx

C++语言毕业课程设计报告长途客运订票系统

(此文档为word格式,下载后您可任意编辑修改!

xxxx大学xx学院

C

题目:

长途客运售票系统

专业:

计算机科学与技术

班级:

姓名:

完成时间:

 

目录

第一部分:

源程序(3-12页)

第二部分:

函数流程图(13-25页)

(1)menu函数流程图(第13页)

(2)enter函数流程图(第14页)

(3)Order函数流程图(第15页)

(4)input函数流程图(第16页)

(5)browse函数流程图(第17页)

(6)Search_time函数流程图(第18页)

(7)Search_end函数流程图(第19页)

(8)search函数流程图(第20页)

(9)voidmenu1函数流程图(第21页)

(10)book函数流程图(第22页)

(11)back函数流程图(第23页)

(12)save函数流程图(第24页)

(13)load函数流程图(第25页)

第三部分:

心得体会(第26-27页)

第一部分:

源程序

#include

#include

#include

#defineN1000

typedefstructplane

{

charID[10];/*客运代号*/

charBePlace[10];/*客运发车地点*/

charEnPlace[10];/*客运到达终点*/

chardata[15];/*客运发车时间*/

intmax;/*客运最大乘客人数*/

intprice;/*客运票价*/

intnum;/*客运已售票数*/

}PLANE;

PLANEti[N];

intn;/*当前的车次数目*/

voidmenu();

voidmenu1();

voidinput(inti)

{

printf("请输入客运代号:

\n");

scanf("%s",ti[i].ID);

printf("请输入发车地点:

\n");

scanf("%s",ti[i].BePlace);

printf("请输入到达地点:

\n");

scanf("%s",ti[i].EnPlace);

printf("请输入发车时间:

\n");

scanf("%s",ti[i].data);

printf("请输入客运的最大载客人数:

\n");

scanf("%d",&ti[i].max);

printf("请输入客运的票价:

\n");

scanf("%d",&ti[i].price);

ti[i].num=0;

}

voidenter()

{

inti;

system("cls");

printf("请输入客运的数目(0-%d)?

:

",N);

scanf("%d",&n);/*要输入的记录个数*/

printf("\n请输入数据\n\n");

for(i=0;i

{

printf("\n请输入第%d车次记录.\n",i+1);

input(i);/*调用输入函数*/

}

getchar();

menu();

}

voidprintf_one(inti)/*显示一个记录的函数*/

{

printf("%11s%6s%10s%6s%6d%6d%6d",ti[i].ID,ti[i].BePlace,ti[i].EnPlace,ti[i].data,ti[i].price,ti[i].max,ti[i].num);

}

voidbrowse()

{

inti;

system("cls");

puts("\n");

printf("\n\t客运代号发车地点到达地点发车时间票价最大乘客已售票数\n");

for(i=0;i

{

printf_one(i);

printf("\n");

}

getchar();

getchar();

menu();

}

voidorder()/*排序模块(按平均成绩)*/

{

inti,j;

structplanes;

system("cls");

for(i=0;i

{

for(j=i+1;j

if(strcmp(ti[i].data,ti[j].data)>0)

{

s=ti[i];

ti[i]=ti[j];

ti[j]=s;}

}

browse();

}

voidsearch_time()

{

inti,m=0;

structplanes;

system("cls");

printf("\n\nEnterthetime:

");

scanf("%s",s.data);/*输入出发的时间*/

puts("\n");

printf("\n\t客运代号发车地点到达地点发车时间票价最大乘客已售票数\n");

for(i=0;i

{

if(strcmp(s.data,ti[i].data)==0)

{

m++;

if((m!

=0)&&(m%10==0))/*目的是分屏显示*/

{

printf("\n\nPressanykeytocontiune...");

getchar();

puts("\n\n");

}

printf_one(i);

printf("\n");

/*调用显示一个记录的函数*/

}

}

puts("\n");

getchar();/*按任意健*/

getchar();

menu1();

}

voidserch_end()

{

inti,m=0;

structplanes;

system("cls");

printf("\n\nEntertheendPlace:

");

scanf("%s",s.EnPlace);/*输入要到达的地方*/

puts("\n");

printf("\n\t客运代号发车地点到达地点发车时间票价最大乘客已售票数\n");

for(i=0;i

{

if(strcmp(ti[i].EnPlace,s.EnPlace)==0)

{

m++;

if((m!

=0)&&(m%10==0))/*目的是分屏显示*/

{

printf("\n\nPressanykeytocontiune...");

getchar();

puts("\n\n");

}

printf_one(i);

printf("\n");

/*调用显示一个记录的函数*/

}

}

puts("\n");

getchar();/*按任意健*/

getchar();

menu1();

}

voidmenu1()

{

intn,w1;

do

{

system("cls");/*清屏*/

puts("\t\t\t\t客运售票操作!

\n\n");

puts("\t\t*********************MENU*********************\n\n");

puts("\t\t\t\t1.按照时间排序");

puts("\t\t\t\t2.按照时间查找车次");

puts("\t\t\t\t3.按照地点查找车次");

puts("\t\t\t\t4.返回主菜单");

puts("\n\n\t\t**********************************************\n");

printf("Choiceyournumber(1-4):

[]\b\b");

scanf("%d",&n);

if(n<1||n>4)/*对选择的数字作判断*/

{

w1=1;

printf("yourchoiceisnotbetween1and4,Pleaseinputagain:

");

getchar();

getchar();

}

elsew1=0;

}while(w1==1);

/*选择功能*/

switch(n)

{

case1:

order();break;

case2:

search_time();break;

case3:

serch_end();break;

case4:

menu();break;

}

}

intsearch()/*查找模块*/

{

inti,k;

structplanes;

k=-1;

system("cls");

printf("\n\n请输入要订票的发车地点:

");

scanf("%s",s.BePlace);/*输入要到达的地方*/

printf("\n\n请输入要订票的到达地点:

");

scanf("%s",s.EnPlace);

printf("\n\n请输入要订票的发车时间:

");

scanf("%s",s.data);/*输入出发的时间*/

for(i=0;i

{

if(strcmp(s.BePlace,ti[i].BePlace)==0&&strcmp(s.EnPlace,ti[i].EnPlace)==0&&strcmp(s.data,ti[i].data)==0)

{

k=i;/*找到要修改的记录*/

printf_one(k);

break;/*调用显示一个记录的函数*/

}

}

if(k==-1)

{

printf("\n\nNOexist!

");

return-1;

}

else

returnk;

}

voidbook()

{

inti;

system("cls");

printf("欢迎进入售票窗口!

\n");

i=search();

if(i!

=-1)

{

if(ti[i].num>=ti[i].max)

{

printf("\n该趟客运票已售完!

");

}

else

{

ti[i].num++;

printf("\n订票成功!

\n");

}

}

else

printf("该客运不存在!

\n");

getchar();

getchar();/*按任意健*/

menu();

}

voidback()

{

inti,k=-1;

structplanes;

system("cls");

printf("欢迎进入退票窗口!

\n");

printf("\n\n输入客运代号:

");

scanf("%s",s.ID);/*输入要到达的地方*/

for(i=0;i

{

if(strcmp(s.ID,ti[i].ID)==0)

{

k=i;/*找到要修改的记录*/

printf_one(k);

break;/*调用显示一个记录的函数*/

}

}

if(k==-1)

{

printf("\n\nNOexist!

");

}

else

{

ti[i].num--;

printf("\n退票成功!

\n");

}

getchar();/*按任意健*/

getchar();/*按任意健*/

menu();

}

voidsave()

{

intw=1;

FILE*fp;

inti;

system("cls");

if((fp=fopen("\\ticket.txt","wt"))==NULL)/*以输出打开方式,在此前的记录被覆盖*/

{

printf("\nCannotopenfile\n");

return;

}

for(i=0;i

if(fwrite(&ti[i],sizeof(structplane),1,fp)!

=1)

{

printf("filewriteerror\n");

w=0;

}

if(w==1)

{

printf("filesaveok!

\n");

}

fclose(fp);

getchar();

getchar();

menu();

}

voidload()

{

FILE*fp;

inti,w;

w=1;

system("cls");

if((fp=fopen("\\ticket.txt","rt"))==NULL)

{

printf("\nCannotopenfile\n");

w=0;

return;

}

n=0;

for(i=0;!

feof(fp);i++)

{

fread(&ti[i],sizeof(structplane),1,fp);

n++;

}

n=n-1;

fclose(fp);

if(w==1)

printf("Loadfileok!

");

getchar();

getchar();

menu();

}

voidmenu()

{

intn,w1;

do

{

system("cls");/*清屏*//*清屏*/

puts("\t\t\t\t客运售票管理系统!

\n\n");

puts("\t\t*********************MENU*********************\n\n");

puts("\t\t\t\t1.输入新车次");

puts("\t\t\t\t2.浏览");

puts("\t\t\t\t3.客运操作");

puts("\t\t\t\t4.订票");

puts("\t\t\t\t5.退票");

puts("\t\t\t\t6.保存");

puts("\t\t\t\t7.载入");

puts("\t\t\t\t8.退出");

puts("\n\n\t\t**********************************************\n");

printf("Choiceyournumber(1-8):

[]\b\b");

scanf("%d",&n);

if(n<1||n>8)/*对选择的数字作判断*/

{

w1=1;

printf("yourchoiceisnotbetween1and8,Pleaseinputentertochoiceagain:

");

getchar();

getchar();

}

elsew1=0;

}while(w1==1);

/*选择功能*/

switch(n)

{

case1:

enter();break;/*输入模块*/

case2:

browse();break;/*浏览模块*/

case3:

menu1();break;/*查找模块*/

case4:

book();break;/*订票模块*/

case5:

back();break;/*退票模块*/

case6:

save();break;/*保存模块*/

case7:

load();break;/*加载模块*/

case8:

exit(0);

}

}

intmain()

{

menu();

}

第二部分:

函数流程图

(1)menu()函数

(2)enter函数

(3)Order函数

(4)input函数

(5)browse函数

(6)Search_time函数

(7)Search_end函数

(8)search函数

(9)voidmenu1函数

(10)book函数

(11)back函数

(12)save函数

load函数

(13)

第三部分:

心得体会

通过对C语言课程设计的学习,自己有很大的收获,将<>应用得到了实践,将所学的各种语句紧密的联系起来,得到了融汇和贯通,使我对C语言有了更深一步的学习和认识。

C语言课程设计更能明显的体现出我们对C语言学习掌握的熟练程度。

因为我们只有在读懂程序的情况下才能更好的做出流程图。

经过一个多星期的上机实践学习,我觉得要想学好它则重在实践,要通过不断地上机操作才能更好的掌握理解。

在学习的同时,也发现了自己学习的许多不足之处,比如,对读程序还不够熟练,对有些语句还没有掌握,再者,自己在指法上还不行,打字过慢而直接影响阅读速度,特别是在运行程序时所出现的错误很难顺利的去找出来并加以纠正,等等。

这些通过学习也有所改进。

通过实践的学习,我认识到学好计算机要重视实践操作,不仅是学习C语言,还是其他语言,以及其他的计算机方面的知识都要重在实践。

所以以后在学习过程中,我会更加注重实践操作,以更好的学习好专业课。

通过对《飞机订票系统》的学习设计,全面系统的理解了编译原理程序构造的一般原理和基本实现方法,把死板的课本知识变得生动有趣,激发了我们学习的积极性。

经过自己设计的流程图将知识表示出来,再加上老师精心的讲解和辅导,加深了我们对理论知识的理解。

课程设计中程序比较复杂,在调试时必须仔细认真,这是最深的感受!

对我们更是一种锻炼!

课程设计的学习,在找出各自不懂和不足积累经验的同时,为我们以后的学习提出了更明确目的和要求:

不仅要读懂程序,而且更重要的是能会熟练地编写程序进而去设计程序。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 书信模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1