数据结构课程设计--航空客运订票系统

数据结构课程设计--航空客运订票系统

一、问题描述:

航空客运订票的业务活动包括:航线查询、客票预定和办理退票等。试设计一个航空客运订票系统、以使上述业务可以借助计算机来完成。

二、基本要求

(1)每条航线所涉及的信息有:终点站名、航班号、飞机号、飞行周日(星期几)、乘员定额、余票量、已订票的客户订单(包括姓名、订票量、舱位等级1,2或3)以及等候替补的客户名单(包括姓名、所需票量);

(2)作为示意系统,全部数据可以只放在内存中;

(3)系统能实现的操作和功能如下:

    a、查询航线:根据旅客提出的终点站名输出下列信息:航班号、飞机号、星期几飞行、最近一天航班的日期和余票额;

    b、承办订票业务:根据珂护提出的要求(航班号、订票数额)查询该航班票额情况,若有余票,则为客户班里订票手续,输出作为好;若已满或者余票少于订票额,则需要重新询问客户要求。若需要,可等级排队侯补;

    c、承办退票业务:根据客户提供的情况(日期、航班),为客户办理退票手续,然后查询该航班是否有人排队侯补,首先询问排在第一的客户,若所退票额能满足他的要求,则为他办理订票手续,否则一次询问其他排队侯补的客户

#include <iostream.h>

#include <process.h>

#include <string.h>

#include <conio.h>

#include <stdio.h>

#include <iomanip.h>

#define MAX 50

#define NULL 0

typedef struct Customer           /*已定票乘客信息*/

{

  char Name[7];             /*姓名*/

  int Amount;             /*定票数*/

  char Rank;                 /*舱位等级*/

  int Seat_No;             /*座位号*/

  struct Customer *Next;

}Customer;

typedef struct Replace           /*替补乘客信息*/

{

  char Name[7];             /*姓名*/

  int Amount;             /*定票数*/

  char Rank;                 /*舱位等级*/

  char Seat_No;             /*座位号*/

  struct Replace *Next;

}Replace,*PReplace;  

typedef struct Flight           /*航线信息*/

{

  char Des_Name[10];           /*终点站名*/

  char Flight_No[6];           /*航班号*/

  char Plane_No[6];           /*飞机号*/

  char Week_Day;             /*飞行周日*/

  int Customer_Amount;         /*乘员定额*/

  int Free_Amount;           /*剩余票数*/

  int Price[3];           /*舱位等级的价格*/

  Replace *ReplName;           /*该航班的候补乘客名单*/

  Customer *CustName;           /*该航班的已定票乘客名单*/

  struct Flight *Next;         /*指示下一航线结点*/

}Flight,*PFlight;

int Customer_Count=0;           /*所有航线的定票乘客总数*/

Flight *Head;                 /*航线头指针*/

Flight *p2;                 /*航线结点指针*/

Customer *Custp1[MAX];           /*各条航线乘客结点指针*/

Replace *Replp1[MAX];           /*各条航线候补结点指针*/

int IsEmpty=1;                 /*是否有定票乘客*/

int IsReplace=1;             /*是否有候补乘客*/

Customer *prior;             /*满足要求的定票乘客的前结点,以作删除操作*/

FILE *fp;                    /*文件指针*/

int shouldsave=0;

char Continue()

{

  char answer;

  while(1)

  { 

    printf("/n/t  Do you want to contiune(Y/N)?");

    scanf("%s",&answer);

    system("cls");

    if(answer=='y'||answer=='Y')

        return 'y';

    else if(answer=='n'||answer=='N')

        return 'n';

    else

          printf("/n/tThe input is error,please input again!");

   

  }

}

/*---------------操作出错函数---------------*/

void ErrorMess()

{

  printf("/n/tSorry,there is no menu!");

  getch();

}

/*-----------------系统退出-----------------*/

int ExitSystem()

{

  char answer;

 printf("/n/t Do you want to exit(Y/N)?");

  scanf("%s",&answer);

  if(answer=='y'||answer=='Y')

    return 1;

  else

    return 0;

}

 

/*--------------航线查找函数-------------*/

/*Find_Line()为重载函数*/

int Find_Line(PFlight L,char *key)/*引用调用*/

{

  int flag=0;   /*该标志位0表示未找到相关信息,反之即找到,以下标志位同理*/

  Flight *p1;

  p1=L;         /*赋航线首地址*/

  if(p1==p2)     /*首航线不作比较*/

    return flag;

  while(p1!=p2&&p1!=NULL)   /*本航班号不纳入比较范围,否则会一直提示航线不唯一*/

  {

    if(strcmp(p1->Flight_No,key)==0)

    {

        flag=1;

        break;

    }

    p1=p1->Next;/*指向下一航班结点*/

  }

    return flag;

}

 

 

int Find_Line(PFlight L,char *key,PFlight &p2,int &Flight_No)/*引用调用*/

{

  int flag=0;   /*该标志位0表示未找到相关信息,反之即找到*/

  Flight *p1;

  p1=L;         /*赋航线首结点*/

  while(p1!=NULL)  

  {

    if(strcmp(p1->Flight_No,key)==0)/*不包括当前航线*/

    {

        flag=1;

        p2=p1;

        break;

    }

    p1=p1->Next;             /*指向下一航班结点*/

    if(p1!=NULL)           /*遇结束符不作统计范围*/

        Flight_No++;

  }

  return flag;

}

 

/*---------------航班查找函数---------------*/

void Line_search()

{

  Flight *p1;

  char c;

  p1=Head;   

 if(Head==NULL)

    {

         printf("/n/tThere is no plane to the place!");

           getch();

        return;

    }

 

   printf("/n/tPlease input the Des_Name:");

   scanf("%s",&p2->Des_Name);

   printf("/n/tThe plane's information:/n");

   printf("/n*****************************************************************************/n");

  while(p1!=NULL)

    {

       

         if(strcmp(p1->Des_Name,p2->Des_Name)==0)

          {

           

       printf("Des_Name Flight_No Plane_No Week_Day Cust_Num Free_Num 1_Price 2_Price 3_Price/n");  

       printf("/n%-9s%-10s%-9s%-9c%-9d%-9d%-8d%-8d%-8d",p1->Des_Name,p1->Flight_No,p1->Plane_No,p1->Week_Day,

                   p1->Customer_Amount,p1->Free_Amount,p1->Price[0],p1->Price[1],p1->Price[2]);           

         }

      p1=p1->Next;

       }  

   printf("/n*****************************************************************************/n");

    Continue();

  } 

 

/*-----------------航线添加函数-------------*/

void Line_Add()

{

  Flight *p1;   /*建立临时航线结点*/

  while(1)

  {

    if(Head==NULL)/*航线为空*/

    {

        p1=p2=new Flight;   /*建立首个航线*/

        Head=p2;

    }

    else

    {

        p1=new Flight; /*建立航线结点*/

        p2->Next=p1;   /*前一航线结点指向当前航班结点*/

        p2=p1;       /*保留当前航班结点地址*/ 

    }

      printf("/n/tAdd the Flight line!/n");

    printf("/n/tPlease input Des_Name:");

    scanf("%s",&p2->Des_Name);  

    while(1)         /*数据合法性检验*/

    {

        printf("/n/tPlease input the only Flight_No:");

        scanf("%s",&p2->Flight_No);

        if(Find_Line(Head,p2->Flight_No))   /*存在航班号*/

          printf("/n/tThe Flight_No is not only!/n");

        else

          break;

    }

    printf("/n/tPlease input the Plane_No:");

    scanf("%s",&p2->Plane_No);

    while(1)

    {  

        printf("/n/tPlease input the fly date(weekday):");

        scanf("%s",&p2->Week_Day);

        if(p2->Week_Day<'1'||p2->Week_Day>'7')

          printf("/n/tThe data is wrong,please input again!/n");

        else

          break;

    }

    printf("/n/tPlease input the Plane_seat Number:");

    scanf("%d",&p2->Customer_Amount);

    printf("/n/tPlease input the First class Price:");

    scanf("%d",&p2->Price[0]);

    printf("/n/tPlease input the Second class Price:");

    scanf("%d",&p2->Price[1]);

    printf("/n/tPlease input the Third class Price:");

    scanf("%d",&p2->Price[2]);

    p2->Free_Amount=p2->Customer_Amount;     /*剩余票数与乘员定额相同*/

    p2->CustName=NULL;                 /*该航线定票乘客头指针为空*/

    p2->ReplName=NULL;               /*初始候补名单为空 */

      shouldsave=1;

    if(Continue()=='n')

    {

        p2->Next=NULL;                 /*航线的下一结点为空*/

        return;

    }

  }

}

/*------------航线是否为空函数-------------*/

int Empty_Flight()

{

  if(Head==NULL)

  {

    system("cls");

    printf("/n/tSorry,there is no Flight Line,Please Return!");

    getch();

    return 1;

  }

  else

    return 0;

}

/*------------航线查看函数-----------------*/

void Line_See()

{

  system("cls");

  Flight *p1;

  p1=Head;

  if(Empty_Flight())   /*航班线为空*/

    return;

  printf("/n/n/tThe plane's information:/n");

  printf("/n*****************************************************************************/n");

  printf("Des_Name Flight_No Plane_No Week_Day Cust_Num Free_Num 1_Price 2_Price 3_Price/n");

  while(p1!=NULL)

  {

    printf("/n%-9s%-10s%-9s%-9c%-9d%-9d%-8d%-8d%-8d",p1->Des_Name,p1->Flight_No,p1->Plane_No,p1->Week_Day,

      p1->Customer_Amount,p1->Free_Amount,p1->Price[0],p1->Price[1],p1->Price[2]);

    p1=p1->Next;

   

  }

  printf("/n*****************************************************************************/n");

  printf("/n/tPress any key to return!/n");

  getch();

}

 void Sub1Menu()

  {

    char c;

    system("cls");

      printf("/n/t/tThe flight manage menu:");

      printf("/n*****************************************************************************/n/n");

      printf("/t1.Add the flight line/n");

      printf("/t2.Search the flight line/n");

      printf("/t3.Look over the flight line/n");

      printf("/t4.Return to the menu/n");

      printf("/n*****************************************************************************/n");

      printf("/tPlease choose:");

    scanf("%s",&c);

    switch(c)

    {

        case '1':Line_Add();break;

           case '2':Line_search();break;

        case '3':Line_See();break;

        case '4':return;

       

    }

}

/*---------------订票办理函数---------------*/

void Sub2Menu()

{

  int Ticket_Count,Seat_No,i,flag=0;

  int Flight_No=0;     /*记录满足条件的航线的定票结点*/

  Flight *p1;           /*记下满足条件的航线结点地址*/

  Customer *p2;         /*临时性定票乘员结点*/

  Replace *p3;         /*临时性候补乘员结点*/

  char answer[7];         /*用户输入的航班数据*/

  char temp;

  char c;

  int tag=0;           /*候补乘客标志位*/

  int IsRepl=0;         /*是否执行候补操作标志位*/

  if(Empty_Flight())     /*航班线为空*/

    return;

  while(1)

  {

    printf("/n/tBook the ticket!");

    flag=0;           /*标志位清零以重新作出判断*/

    Flight_No=0;

    tag=0;

    printf("/n/tPlesae input the Flight_No:");

    scanf("%s",&answer);

    if(Find_Line(Head,answer,p1,Flight_No))     /*调用航线查找函数,若存在则进行以下操作*/

    {

        while(1)                     /*数据合法性检验*/

        {

          printf("/n/tPlease input the Num what you want to book:");

          scanf("%d",&Ticket_Count);

          if(Ticket_Count==0)

          {

            printf("/n/tPlease input the Num again:/n");

            getch();

          }

          else

            break;

        }

        if(p1->Free_Amount>=Ticket_Count)

        {  

          Customer_Count++;                 /*定票乘客总数增1*/

          flag=1;                         /*表明进入了订票实际操作*/

          IsRepl=1;                       /*定票量满足,无需进入候补操作*/

          if(p1->CustName==NULL)               /*首个定票乘客,并记录相关属性*/

          {  

            Custp1[Flight_No]=p2=new Customer;     /*建立该航线的首位乘客结点*/

            p1->CustName=Custp1[Flight_No];

          }

          else                         /*建立该航线的后续乘客结点*/

          {

            p2=new Customer;  

            Custp1[Flight_No]->Next=p2;

            Custp1[Flight_No]=p2;

          }

            IsEmpty=0;                           /*定票乘员不为空*/

            Custp1[Flight_No]->Amount=Ticket_Count;         /*订票数*/

            Seat_No=p1->Customer_Amount-p1->Free_Amount+1;   /*算出座位号*/

            Custp1[Flight_No]->Seat_No=Seat_No;           /*赋座位号*/

            p1->Free_Amount-=Ticket_Count;             /*减去定票数*/

            printf("/n/tPlease input your name:");

            scanf("%s",&Custp1[Flight_No]->Name);

            while(1)                           /*数据合法性检验*/

            {

                printf("/n/tPlease input the Class Num:");

                scanf("%s",&Custp1[Flight_No]->Rank);

                if(!(Custp1[Flight_No]->Rank>='1'&&Custp1[Flight_No]->Rank<='3'))

                {

                  printf("/n/tThe num is error,Please input again!");

                  getch();

                }

            else

                break;

            }

            printf("/n/tPlease input your Seat_No:");

                 scanf("%d",&Custp1[Flight_No]->Seat_No);

            if(Ticket_Count<10)         /*为显示规整,作相应处理*/

                printf("/n/t");

            else

                printf("/n/t");

            for(i=1;i<=Ticket_Count;i++) /*打印座位号*/

            {

                printf("/n/tThe Seat_No is %d",Seat_No++);

                if(i%10==0)

                  printf("/n/t");

            }

            printf("/n");  

        }/*满足定票数*/

        else if(p1->Free_Amount==0)

        {

          printf("/n/tSorry,there is no ticket!/n");

          IsRepl=0;

        }

        else

        {

          printf("/n/tSorry,there are not many tickets you want!/n");

          IsRepl=0;

        }

        if(!IsRepl)

        {

          printf("/n/tDo you want to be a replace passager(Y/N)?");

          scanf("%s",&temp);

          if(temp=='y'||temp=='Y')/*以下为候补操作*/

          {

            if(p1->ReplName==NULL)

            {

                Replp1[Flight_No]=p3=new Replace;     /*建立该航线的首位候补乘客结点*/

                p1->ReplName=Replp1[Flight_No];

            }

            else

            {

                p3=new Replace;

                Replp1[Flight_No]->Next=p3;

                Replp1[Flight_No]=p3;

            }

            IsReplace=0;     /*候补乘客不为空*/

            tag=1;           /*已选择列入候补乘客名单*/

            Replp1[Flight_No]->Amount=Ticket_Count;

            printf("/n/tPlease input your Flight_No:");

            scanf("%s",&Replp1[Flight_No]->Name);

            Replp1[Flight_No]->Seat_No=Seat_No;           /*候补乘客的座位*/

            Replp1[Flight_No]->Amount=Ticket_Count;         /*候补乘客的订票数*/

            while(1)                           /*数据合法性检验*/

            {

                printf("/n/tPlease input the Class_No:");

                scanf("%s",&Replp1[Flight_No]->Rank);

                if(!(Replp1[Flight_No]->Rank>='1'&&Replp1[Flight_No]->Rank<='3'))

                {

                  printf("/n/tThe num is wrong,please input again.");

                  getch();

                }

            else

                break;

            }

            printf("/n/tThe passage no seat!/n");/*候补乘客无座提示*/

                 shouldsave=1;

          }/*进入候补名单  */           

        }/*票数满足*/

    }/*航线存在*/

    else

        printf("/n/tSorry,the flight is not exist!/n");/*航线不存在*/

    if(flag)     /*此处不作处理,则会地址溢出*/

        Custp1[Flight_No]->Next=NULL;/*末位定票乘客的指针置空*/

    if(tag)

    {

        Replp1[Flight_No]->Next=NULL;/*末位候补乘客的指针置空*/

        printf("/n/t It is success!/n");

    }

   printf("/n/tDo you want to leave:(y/n)");

   scanf("%s",&c);

   if(c=='y')

    return;

  }/*while*/

}  

/*-----------------订票乘客信息-----------------*/

void Display_Reserve()

{

  system("cls");

  Flight *p1;

  Customer *p2;

  p1=Head;

 

  if(Empty_Flight())

    return;

  printf("/n/tThe passager's list");

  if(IsEmpty)

  {

    printf("/n/tSorry,there is none passager!/n");

    getch();

    return;

  }

 printf("/n*****************************************************************************/n");

 printf("Name    Flight_No Plane_No Tic_Amount Des_Name Rank_No Seat_No/n");

  while(p1!=NULL)

  {

    if(p1->CustName!=NULL)

    {

        p2=p1->CustName;

        while(p2!=NULL)

        {

          printf("/n%-8s%-10s%-9s%-11d%-9s%-9c%-9d",p2->Name,p1->Flight_No,p1->Plane_No,p2->Amount,p1->Des_Name,p2->Rank,p2->Seat_No);         

          if(p2->Amount>1)

            printf("/n/n/tThere has more tickets!/n");

          else

            printf("/n/n/tThere is no ticket!/n");

          p2=p2->Next;

        

        }

    }

    p1=p1->Next;

    printf("/n/n*****************************************************************************/n");

  }  

  

  printf("/n/tPress any key to return!");

  getch();

  return;

}

/*-----------------候补乘客信息-----------------*/

void Display_Replace()

{

  system("cls");

  Flight *p1;

  Replace *p2;

  p1=Head;

  if(Empty_Flight())

    return;

    printf("/n/tThere is no replace people list!");

  if(IsReplace)

  {

    printf("/n/tSorry,There is no replace passager!/n");

    getch();

    return;

  }

  printf("/n*****************************************************************************/n");

 printf("Name Flight_No Plane_No Tic_Amount Des_Name Rank_No Seat_No/n");

  while(p1!=NULL)

  {

    if(p1->ReplName!=NULL)

    {

        p2=p1->ReplName;

        while(p2!=NULL)

        {

          printf("/n%-8s%-10s%-9s%-11d%-9s%-9c%-9d",p2->Name,p1->Flight_No,p1->Plane_No,p2->Amount,p1->Des_Name,p2->Rank,p2->Seat_No);

          if(p2->Amount>1)

            printf("/tThere has more tickets!/n");

          else

            printf("/tThere is no ticket!/n");

          p2=p2->Next;

        }

    }

    p1=p1->Next;

  }  

  printf("/n/n*****************************************************************************/n");

  printf("/n/tPlease press any key to return!");

  getch();

  return;

}

/*-----------------退票办理函数-----------------*/

void Sub3Menu()

{

  int Flight_No=0,flag=0;     /*记录满足条件的航线的定票结点*/

  Flight *p1;           /*记下满足条件的航线结点地址*/

  Customer *p2,*p4;         /*临时性定票乘员结点*/

  Replace *p3,*p5;         /*临时性候补乘员结点*/

  char answer[7],name[7];     /*用户输入的航班数据*/

  int tag=0;             /*若第二乘客满足条件,则它的首地址会发生冲突,注意此处*/

  int Seat_No;           /*记录座位号*/

  if(Empty_Flight())         /*航班线为空*/

    return;

  printf("/n/tRefund the ticket");

  if(IsEmpty)

  {

    printf("/n/tSorry,There is no passager!");

    getch();

    return;

  }

  while(1)

  {

    flag=0;

    tag=0;

    Flight_No=0;

    printf("/n/tRefund the ticket");

    printf("/n/tPlease input the Flight_No:");

    scanf("%s",&answer);

    if(Find_Line(Head,answer,p1,Flight_No))     /*航线存在*/

    {

        p2=p1->CustName;     /*指向该航线的乘客名单的首地址 */

        printf("/n/tPlease input the name:");

        scanf("%s",&name);

        if(p2==NULL)     /*该航线无定票乘客*/

        {

          printf("/n/tSorry,there is no passager!.");

          if(Continue()=='n')/*是否继续操作*/

            return;

        }

        else    

          while(p2!=NULL)/*查找有无此乘客名*/

          {

            if(strcmp(p2->Name,name)==0)/*此外括号不能省略,否则功能会转变*/

            {

                if(p2==p1->CustName)   /*若为首位乘客满足*/  

                {

                  prior=p1->CustName; /*记录指针*/

                  Seat_No=p2->Seat_No;

                  flag=1;

                  break;

                }

            }

            else if(p2->Next!=NULL)/*记录满足航线的的前结点地址 */

            {

                if(strcmp(p2->Next->Name,name)==0)

                {

                  tag=1;         /*特别注意此处*/

                  prior=p2;     /*记录满足定乘客的前一地址,以作删除操作*/

                  Seat_No=p2->Next->Seat_No;

                  flag=1;

                  break;

                }

            }

            p2=p2->Next; /*指向下一乘客结点*/

                 shouldsave=1;

          }/*while */ 

          if(!flag)

            printf("/n/tSorry,there is no passager!/n");

    }/*存在该航线*/

    else

        printf("/n/tSorry,there is no Flight_No!/n");

    if(flag)

    {

        if(prior==p1->CustName&&!tag)   /*首结点满足条件且一个乘客,则该航线定票乘客置空*/

        {

          if(prior->Next==NULL)     /*仅一乘客,头指针置空*/

          {

            p1->Free_Amount+=prior->Amount;

            p1->CustName=NULL;

          }

          else  

          {

            p1->Free_Amount+=prior->Next->Amount;

            p1->CustName=prior->Next; /*指向下一乘客结点*/

          }

        }

        else

        {

          p1->Free_Amount+=prior->Next->Amount;

          prior->Next=prior->Next->Next;   /*删除操作*/

        }

        Customer_Count--;

        if(Customer_Count==0)

          IsEmpty=1;

           shouldsave=1;

    }

    if(flag)/*存在退票操作*/

    {

        p3=p1->ReplName;

        while(p3!=NULL)

        {

        if(p3->Amount<=p1->Free_Amount)/*候补乘客的定票数小于或等于剩余票数*/

        {

         

          printf("/n/tThe replace passager has in the list!/n");

          p4=Custp1[Flight_No]->Next=new Customer;

          p4->Next=NULL;

          IsEmpty=0;

          if(p1->CustName==NULL)

              p1->CustName=p4;

          strcpy(p4->Name,p3->Name);

          p4->Rank=p3->Rank;

          p4->Amount=p3->Amount;

          p4->Seat_No=Seat_No;

          p1->Free_Amount-=p3->Amount;   /*减去相应的票数*/

          Customer_Count++;

          if(p3->Next==NULL) /*无候补乘客 */

            IsReplace=1;

          if(p1->ReplName==p3)

          {

              if(p1->ReplName->Next==NULL)

                p1->ReplName=NULL;/*删除*/

              else

                p1->ReplName=p3->Next;

          }

          else

            p5->Next=p3->Next->Next;

          break;  

        }

        if(p3->Next!=NULL)

          if(p3->Next->Amount<=p1->Free_Amount)

            p5=p3;

            p3=p3->Next; /*指向下一候补乘客结点*/

           shouldsave=1;

        }

        printf("/n/tIt is succeess to refund the ticket!");

        getch();

        return;

    }/*存在此乘客*/

 

      shouldsave=1;

    if(Continue()=='n')

        return;

  }/*while*/

}

/*---------------乘客管理子菜单函数-----------------*/

void Sub4Menu()

{

 char c;

 system("cls");

  printf("/n/t/tThe flight passager manage menu:/n");

  printf("/n*****************************************************************************/n/n");

  printf("/t1.The passage's information/n");

  printf("/t2.The replace passage's information/n");

  printf("/t3.Return to the menu/n");

  printf("/n*****************************************************************************/n");

  printf("/tPlease choose:");

  scanf("%s",&c);

    switch(c)

    {

        case '1':Display_Reserve();break;

        case '2':Display_Replace();break;

        case '3':return;

        default:ErrorMess();

    }

}

 

void Save()

{

  Flight *p1;

  p1=Head;

  int flag=1,count=0;

  fp=fopen("paper","wb");

  if(fp==NULL)

    {

     printf("/n/tCannot open the paper!/n");

     exit(1);

    }

    p1=p2->Next;

 

    while(p1)

      {

       if(fwrite(p2,sizeof(Flight),1,fp)==1)

        { 

          p1=p1->Next;

          count++;

        }

      else

       {

         flag=0;

         break;

        }

      }

    if(flag)

      {

        printf("/n/tSave succesd.the recordsis:%d/n",count);

        shouldsave=0;

      }

     fclose(fp);

 }

 

 

 

/*-------下面为主程序画面函数----------*/

void main()

{

 

  Flight *p1;

  p1=Head;

  char c,create,ch;

  int count;

  fp=fopen("paper","rb");

  if(fp==NULL)

   {

     printf("/n/tThe paper is not exist,do you want to create?(y/n)/n");

     scanf("%s",&create);

     if(create=='y'||create=='Y')

       fp=fopen("paper","wb");

     else

     exit(0);

    }

    printf("/n/tThe paper has opened!/n");

 

  while(!feof(fp))

    {

      p2=new Flight;

     if(fread(p2,sizeof(PFlight),1,fp)) /*将文件的内容放入接点中  */

       {

         p2->Next=NULL;

         p1->Next=p2;

         p1=p2; /*将该接点挂入连中 */

         count++;

       }

    }

    fclose(fp); /*关闭文件    */

    printf("/nThe records is:%d./n",count);

     

     

 

  do{

  system("cls");

  printf("/n/t/tThe Flight Manage System/n");

  printf("/n*****************************************************************************/n/n");

  printf("/t1.The flight line manage menu:/n");

  printf("/t2.The book ticket manage menu:/n");

  printf("/t3.The refund ticket manage menu:/n");

  printf("/t4.The passager manage menu:/n");

  printf("/t5.Save and Exit the system/n");

  printf("/n*****************************************************************************/n");

  printf("/tPlease choose:");

   scanf("%s",&c);

    switch(c)

    {

    case '1':Sub1Menu();break;           /*航线管理*/

    case '2':Sub2Menu();break;           /*订票办理*/

    case '3':Sub3Menu();break;           /*退票办理*/

    case '4':Sub4Menu();break;           /*乘客管理*/

    case '5':

               if(shouldsave==1)

                { getchar();

                  printf("/nThe information has changed,save or not:(y/n)?/n");

                  scanf("%s",&ch);

                  if(ch=='y'||ch=='Y')

                  Save();

                } 

      if(ExitSystem()) return;   /*退出系统*/     

    default:break;

  }

  }while(c!='5');

 }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值