|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <memory.h>
|
|
|
|
|
|
|
|
|
|
typedef struct Flight
|
|
|
|
|
{
|
|
|
|
|
int FlightNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int MaxFare; //<2F><><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD>
|
|
|
|
|
char StartPlace[10]; //<2F><><EFBFBD>ɵص<C9B5>
|
|
|
|
|
char EndPlace[10]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
|
|
|
|
char StartDate[10]; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
char EndDate[10]; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
float price; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int currentFareNum; //<2F><>ǰ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD>
|
|
|
|
|
|
|
|
|
|
struct Flight* prev;
|
|
|
|
|
struct Flight* next;
|
|
|
|
|
}FlightList;
|
|
|
|
|
|
|
|
|
|
typedef struct Fare
|
|
|
|
|
{
|
|
|
|
|
int FlightNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
char IDnumber[20]; //<2F><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>
|
|
|
|
|
char name[10]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char gender[5]; //<2F>Ա<EFBFBD>
|
|
|
|
|
char birthDate[10]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int SeatNumber; //<2F><>λ<EFBFBD><CEBB>
|
|
|
|
|
|
|
|
|
|
struct Fare* prev;
|
|
|
|
|
struct Fare* next;
|
|
|
|
|
}FareList;
|
|
|
|
|
|
|
|
|
|
int FlightNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int FareNum; //<2F>˿<EFBFBD><CBBF><EFBFBD>
|
|
|
|
|
FlightList* FlightHead; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
|
|
|
|
FareList* FareHead; //<2F>˿<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
/********************<2A>ļ<EFBFBD>************************/
|
|
|
|
|
void ReadFlightInfo(void); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void ReadPareInfo(void); //<2F><>ȡ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|
|
|
|
void WriteFlightInfo(FILE* Fp); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
void WritePareInfo(FILE* Fp); //<2F><><EFBFBD>˿<EFBFBD><CBBF><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
int CopyArrayToNum(char* str, int start, int end); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CopyArrayToStr(char* str1, char* str2,int start, int end); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鵽<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
float CopyArrayToFloat(char* str, int start, int end); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/*******************<2A><><EFBFBD><EFBFBD>*************************/
|
|
|
|
|
FlightList* FlightMallocFunc(void); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѿռ<D1BF>
|
|
|
|
|
FareList* FareMallocFunc(void); //<2F>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѿռ<D1BF>
|
|
|
|
|
FlightList* FlightCreateNewNode(void); //<2F><><EFBFBD>ഴ<EFBFBD><E0B4B4><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
FareList* FareCreateNewNode(void); //<2F>˿ʹ<CBBF><CDB4><EFBFBD><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
void FlightDeleteAllNode(void); //ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
void FareDeleteAllNode(void); //ɾ<><C9BE><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
void FlightInsertNode(FlightList *h_node, FlightList *node, FlightList *n_node); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ڵ<C2BD><DAB5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
void FareInsertNode(FareList *h_node, FareList *node, FareList *n_node); //<2F>˿͵<CBBF><CDB5><EFBFBD><EFBFBD>½ڵ<C2BD><DAB5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
/******************<2A><><EFBFBD><EFBFBD>**************************/
|
|
|
|
|
void ModeFlightMenu(void); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
void ModeShowAllFlight(void); //<2F><>ʾ<EFBFBD><CABE><EFBFBD>к<EFBFBD><D0BA><EFBFBD>
|
|
|
|
|
void ModeAddFlight(void); //<2F><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
|
|
|
|
|
void ModeCancelFlight(void); //ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/*******************<2A>˿<EFBFBD>*************************/
|
|
|
|
|
void ModeFareMenu(void); //<2F><>ʾ<EFBFBD>˿Ͳ˵<CDB2>
|
|
|
|
|
void ModeShowAllFare(void); //<2F><>ʾ<EFBFBD><CABE><EFBFBD>г˿<D0B3>
|
|
|
|
|
void ModeAddFare(void); //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|
|
|
|
void ModeDeleteFare(void); //ɾ<><C9BE><EFBFBD>˿<EFBFBD>
|
|
|
|
|
void ModeFlightReserve(void); //<2F><><EFBFBD>ඩƱ
|
|
|
|
|
|
|
|
|
|
void ModeExitSystem(void); //<2F>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
FlightNum = 0;
|
|
|
|
|
FareNum = 0;
|
|
|
|
|
FlightHead = FlightMallocFunc();
|
|
|
|
|
FareHead = FareMallocFunc();
|
|
|
|
|
FlightHead->next = FlightHead->prev = FlightHead;
|
|
|
|
|
FareHead->next = FareHead->prev = FareHead;
|
|
|
|
|
|
|
|
|
|
ReadFlightInfo();
|
|
|
|
|
ReadPareInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int menu = 0,role = 0;
|
|
|
|
|
system("CLS"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("**************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>*******************\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա 2.<2E>˿<EFBFBD> 0.<2E>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&role);
|
|
|
|
|
if (role != 1 && role != 2 && role != 0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷָ<EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if (role == 1)
|
|
|
|
|
{
|
|
|
|
|
int mode = 0;
|
|
|
|
|
system("CLS"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ModeFlightMenu();
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
switch(mode)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
ModeShowAllFlight(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD>к<EFBFBD><D0BA><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ModeAddFlight(); //<2F><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ModeCancelFlight(); //ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
menu = 1; //<2F><><EFBFBD>ز˵<D8B2>
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
ModeExitSystem();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷָ<EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (role == 2)
|
|
|
|
|
{
|
|
|
|
|
int mode = 0;
|
|
|
|
|
system("CLS"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ModeFareMenu();
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
ModeShowAllFare(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD>г˿<D0B3>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ModeAddFare(); //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ModeDeleteFare(); //ɾ<><C9BE><EFBFBD>˿<EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
ModeFlightReserve(); //<2F><><EFBFBD>ඩƱ
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
menu = 1; //<2F><><EFBFBD>ز˵<D8B2>
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
ModeExitSystem();
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷָ<EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
ModeExitSystem();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (menu == 1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReadFlightInfo(void)//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
{
|
|
|
|
|
char Info[100];
|
|
|
|
|
char* p;
|
|
|
|
|
int a, i, start, StrLength;
|
|
|
|
|
FlightList* node;
|
|
|
|
|
FILE* FlightFp = fopen(".\\FlightInfo.txt","a+");
|
|
|
|
|
if(FlightFp == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("open file failed!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fseek(FlightFp, 0, SEEK_SET); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ͷ
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
a=1;
|
|
|
|
|
memset(Info, 0, sizeof(Info));
|
|
|
|
|
fseek(FlightFp, 0, SEEK_CUR);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>λ<EFBFBD>ö<EFBFBD>ȡ
|
|
|
|
|
fgets(Info, 100, FlightFp);
|
|
|
|
|
if (Info[0] == 0)//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>δ
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
node = FlightCreateNewNode();//<2F><><EFBFBD><EFBFBD><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
StrLength = strlen(Info);
|
|
|
|
|
start = 0;
|
|
|
|
|
for (i = 0,p=Info; i<StrLength; p++, i++)
|
|
|
|
|
{
|
|
|
|
|
if(*p == ' ' || *p == '\n')
|
|
|
|
|
{
|
|
|
|
|
switch (a)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
node->FlightNum = CopyArrayToNum(Info, start, i); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
node->MaxFare = CopyArrayToNum(Info, start, i); //<2F><><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
CopyArrayToStr(node->StartPlace, Info, start, i); //<2F><><EFBFBD>ɵص<C9B5>
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
CopyArrayToStr(node->EndPlace, Info, start, i); //<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
CopyArrayToStr(node->StartDate, Info, start, i); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
CopyArrayToStr(node->EndDate, Info, start, i); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
node->price = CopyArrayToFloat(Info, start, i); //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
node->currentFareNum = CopyArrayToNum(Info, start, i);//<2F><>ǰ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start = i+1;
|
|
|
|
|
a++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(FlightFp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReadPareInfo(void)//<2F><>ȡ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|
|
|
|
{
|
|
|
|
|
char Info[100];
|
|
|
|
|
char* p;
|
|
|
|
|
int a, i, start, StrLength;
|
|
|
|
|
FareList* node;
|
|
|
|
|
FILE* pareFp = fopen(".\\PareInfo.txt","a+");
|
|
|
|
|
if(pareFp == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("open file failed!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fseek(pareFp, 0, SEEK_SET); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ͷ
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
a=1;
|
|
|
|
|
memset(Info, 0, sizeof(Info));
|
|
|
|
|
fseek(pareFp, 0, SEEK_CUR);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>λ<EFBFBD>ö<EFBFBD>ȡ
|
|
|
|
|
fgets(Info, 100, pareFp);
|
|
|
|
|
if (Info[0] == 0)//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>δ
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
node = FareCreateNewNode();//<2F><><EFBFBD><EFBFBD><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
StrLength = strlen(Info);
|
|
|
|
|
start = 0;
|
|
|
|
|
for (i = 0,p=Info; i<StrLength; p++, i++)
|
|
|
|
|
{
|
|
|
|
|
if(*p == ' ' || *p == '\n')
|
|
|
|
|
{
|
|
|
|
|
switch (a)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
node->FlightNum = CopyArrayToNum(Info, start, i); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
CopyArrayToStr(node->IDnumber, Info, start, i); //<2F><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
CopyArrayToStr(node->name, Info, start, i); //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
CopyArrayToStr(node->gender, Info, start, i); //<2F>Ա<EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
CopyArrayToStr(node->birthDate, Info, start, i); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
node->SeatNumber = CopyArrayToNum(Info, start, i); //<2F><>λ<EFBFBD><CEBB>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start = i+1;
|
|
|
|
|
a++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(pareFp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CopyArrayToStr(char* str1, char* str2,int start, int end)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鵽<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int numder = abs(end-start);
|
|
|
|
|
|
|
|
|
|
for (i=0; i<numder; i++)
|
|
|
|
|
str1[i] = str2[start+i];
|
|
|
|
|
|
|
|
|
|
str1[numder] = '\0';
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CopyArrayToNum(char* str, int start, int end)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i, len;
|
|
|
|
|
int numder = 0;
|
|
|
|
|
char str1[10];
|
|
|
|
|
numder = abs(end-start);
|
|
|
|
|
|
|
|
|
|
for (i=0; i<numder; i++)
|
|
|
|
|
str1[i] = str[start+i];
|
|
|
|
|
|
|
|
|
|
len = strlen(str1);
|
|
|
|
|
str1[len] = '\0';
|
|
|
|
|
return atoi(str1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float CopyArrayToFloat(char* str, int start, int end)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i, len;
|
|
|
|
|
int numder = 0;
|
|
|
|
|
char str1[10];
|
|
|
|
|
numder = abs(end-start);
|
|
|
|
|
|
|
|
|
|
for (i=0; i<numder; i++)
|
|
|
|
|
str1[i] = str[start+i];
|
|
|
|
|
|
|
|
|
|
len = strlen(str1);
|
|
|
|
|
str1[len] = '\0';
|
|
|
|
|
return atof(str1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WriteFlightInfo(FILE* Fp)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FlightList* p;
|
|
|
|
|
for (p = FlightHead->next; p!= FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
fprintf(Fp,"%d %d %s %s %s %s %.2f %d\n",p->FlightNum,p->MaxFare,p->StartPlace,p->EndPlace,p->StartDate,p->EndDate,p->price,p->currentFareNum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WritePareInfo(FILE* Fp)//<2F><><EFBFBD>˿<EFBFBD><CBBF><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FareList* p;
|
|
|
|
|
for (p = FareHead->next; p!= FareHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
fprintf(Fp,"%d %s %s %s %s %d\n",p->FlightNum,p->IDnumber,p->name,p->gender,p->birthDate,p->SeatNumber);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeFlightMenu(void)//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
printf("***********<2A><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>***********\n");
|
|
|
|
|
printf("1.<2E><>ʾ<EFBFBD><CABE><EFBFBD>к<EFBFBD><D0BA><EFBFBD>\n"
|
|
|
|
|
"2.<2E><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>\n"
|
|
|
|
|
"3.ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n"
|
|
|
|
|
"4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ\n"
|
|
|
|
|
"0.<2E>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>\n"
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeShowAllFlight(void)//<2F><>ʾ<EFBFBD><CABE><EFBFBD>к<EFBFBD><D0BA><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FlightList* p;
|
|
|
|
|
if(FlightNum == 0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
system("CLS"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("********<2A><>ǰ<EFBFBD><C7B0>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d**********\n",FlightNum);
|
|
|
|
|
for (p = FlightHead->next; p!=FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
printf(">>>>>><3E><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%d<<<<<<\n",p->FlightNum);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD>:%d\n<EFBFBD><EFBFBD><EFBFBD>ɵص<EFBFBD>:%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>:%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>:%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.2f\n<EFBFBD><EFBFBD>ǰ<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD>:%d\n",
|
|
|
|
|
p->MaxFare,p->StartPlace,p->EndPlace,p->StartDate,p->EndDate,p->price,p->currentFareNum);
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeAddFlight(void)//<2F><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FlightList* NewFlight = FlightCreateNewNode();
|
|
|
|
|
FlightList* p;
|
|
|
|
|
printf("*************<2A><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD><EFBFBD><EFBFBD>Ϣ*****************\n");
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int Numder = 0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
if (!(scanf("%d",&Numder)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (p->FlightNum == Numder)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p != FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
NewFlight->FlightNum = Numder;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
if (!(scanf("%d",&(NewFlight->MaxFare))))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ɵص㣺");
|
|
|
|
|
if (!(scanf("%s",NewFlight->StartPlace)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص㣺");
|
|
|
|
|
if (!(scanf("%s",NewFlight->EndPlace)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺");
|
|
|
|
|
if (!(scanf("%s",NewFlight->StartDate)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺");
|
|
|
|
|
if (!(scanf("%s",NewFlight->EndDate)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ۣ<EFBFBD>");
|
|
|
|
|
if (!(scanf("%f",&(NewFlight->price))))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeCancelFlight(void)//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FlightList* p;
|
|
|
|
|
FareList* q;
|
|
|
|
|
int Num =0;
|
|
|
|
|
printf("*************ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*****************\n");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫȡ<EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
if (!(scanf("%d",&Num)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (p->FlightNum == Num)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
if ((p->MaxFare*0.1) < p->currentFareNum)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٷ<EFBFBD>֮10<EFBFBD>ij˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int mode = 0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><EFBFBD>У<EFBFBD>%d\n", p->currentFareNum);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD>ȡ<EFBFBD><EFBFBD> 1.<2E><> 2.<2E><><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
if (mode != 1 && mode != 2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷָ<EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (mode == 1)
|
|
|
|
|
{
|
|
|
|
|
p->currentFareNum = 0;
|
|
|
|
|
for (q = FareHead->next; q != FareHead; q = q->next)
|
|
|
|
|
{
|
|
|
|
|
if (q->FlightNum == p->FlightNum)
|
|
|
|
|
q->SeatNumber = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD>ij˿<C4B3><CBBF><EFBFBD><EFBFBD><EFBFBD>Ʊ\n", p->FlightNum);
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeFareMenu(void)//<2F><>ʾ<EFBFBD>˿Ͳ˵<CDB2>
|
|
|
|
|
{
|
|
|
|
|
printf("***********<2A>˿Ͳ˵<CDB2>***********\n");
|
|
|
|
|
printf("1.<2E><>ʾ<EFBFBD><CABE><EFBFBD>г˿<D0B3>\n"
|
|
|
|
|
"2.<2E><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>\n"
|
|
|
|
|
"3.ɾ<><C9BE><EFBFBD>˿<EFBFBD>\n"
|
|
|
|
|
"4.<2E><><EFBFBD>ඩƱ\n"
|
|
|
|
|
"5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ\n"
|
|
|
|
|
"0.<2E>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>\n"
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeShowAllFare(void)//<2F><>ʾ<EFBFBD><CABE><EFBFBD>г˿<D0B3>
|
|
|
|
|
{
|
|
|
|
|
FareList* p;
|
|
|
|
|
if(FareNum == 0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰ<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
system("CLS"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("********<2A><>ǰ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d**********\n",FareNum);
|
|
|
|
|
for (p = FareHead->next; p!=FareHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
printf(">>>>>><3E><>ǰ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<<<<<<\n",p->name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>:%s\n<EFBFBD>Ա<EFBFBD>:%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>:%d\n",p->FlightNum,p->IDnumber,p->gender,p->birthDate,p->SeatNumber);
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeAddFare(void)//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FareList* node = FareCreateNewNode();
|
|
|
|
|
printf("******<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><CBBF><EFBFBD>Ϣ*******\n");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
if (!(scanf("%s",node->name)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
if (!(scanf("%s",node->IDnumber)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int gender = 0,input = 0;
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD>1.<2E><> 2.Ů<><C5AE>");
|
|
|
|
|
input = scanf("%d",&gender);
|
|
|
|
|
if (input != 1 && input != 2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (gender == 1)
|
|
|
|
|
strcpy(node->gender,"<EFBFBD><EFBFBD>");
|
|
|
|
|
else
|
|
|
|
|
strcpy(node->gender,"Ů");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int year = 0,month = 0,input = 0;
|
|
|
|
|
char date[10],str[10];
|
|
|
|
|
memset(date, 0, sizeof(date));
|
|
|
|
|
memset(str, 0, sizeof(str));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>");
|
|
|
|
|
input = scanf("%d",&year);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·ݣ<EFBFBD>");
|
|
|
|
|
input = scanf("%d",&month);
|
|
|
|
|
if (input && (year < 1900 || year > 2019) && (month > 12 || month <= 0))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD><EFBFBD>·ݣ<EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strcpy(date,strcat(itoa(year,str,10),"/"));
|
|
|
|
|
memset(str, 0, sizeof(str));
|
|
|
|
|
strcat(date,itoa(month,str,10));
|
|
|
|
|
memset(str, 0, sizeof(str));
|
|
|
|
|
strcpy(node->birthDate,date);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeDeleteFare(void)//ɾ<><C9BE><EFBFBD>˿<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
FareList* p;
|
|
|
|
|
char name[10];
|
|
|
|
|
memset(name, 0, sizeof(name));
|
|
|
|
|
printf("***********ɾ<><C9BE><EFBFBD>˿<EFBFBD>**************\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD>ij˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s", name);
|
|
|
|
|
for (p = FareHead->next; p != FareHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (!(strcmp(p->name,name)))
|
|
|
|
|
{
|
|
|
|
|
p->prev->next = p->next;
|
|
|
|
|
p->next->prev = p->prev;
|
|
|
|
|
free(p);
|
|
|
|
|
FareNum--;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (p == FareHead)
|
|
|
|
|
{
|
|
|
|
|
printf("δ<EFBFBD>ҵ<EFBFBD><EFBFBD>ó˿ͣ<EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeFlightReserve(void)//<2F><><EFBFBD>ඩƱ
|
|
|
|
|
{
|
|
|
|
|
FlightList* p;
|
|
|
|
|
FareList* q;
|
|
|
|
|
char FindName[10];
|
|
|
|
|
memset(FindName,0,sizeof(FindName));
|
|
|
|
|
printf("***************<2A><><EFBFBD>ඩƱ***************\n");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ʊ<EFBFBD>ij˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
if (!(scanf("%s",FindName)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (q = FareHead->next; q != FareHead; q= q->next)
|
|
|
|
|
{
|
|
|
|
|
if(!strcmp(q->name,FindName))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (q == FareHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иó˿ͣ<EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int mode = 0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2.<2E><><EFBFBD>ɵص<C9B5> 3.<2E><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> 4.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> 5.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
if (!(scanf("%d",&(q->FlightNum))))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (p->FlightNum == q->FlightNum)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
char StartPlace[10];
|
|
|
|
|
memset(StartPlace, 0, sizeof(StartPlace));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ɵص㣺");
|
|
|
|
|
if (!(scanf("%s",StartPlace)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(p->StartPlace,StartPlace))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
char EndPlace[10];
|
|
|
|
|
memset(EndPlace, 0, sizeof(EndPlace));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص㣺");
|
|
|
|
|
if (!(scanf("%s",EndPlace)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(p->EndPlace,EndPlace))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
char StartDate[10];
|
|
|
|
|
memset(StartDate, 0, sizeof(StartDate));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺");
|
|
|
|
|
if (!(scanf("%s",StartDate)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(p->StartDate,StartDate))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
char EndDate[10];
|
|
|
|
|
memset(EndDate, 0, sizeof(EndDate));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺");
|
|
|
|
|
if (!(scanf("%s",EndDate)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (p = FlightHead->next; p != FlightHead; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(p->EndDate,EndDate))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (p == FlightHead)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD>иú<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD> <20><><EFBFBD>ɵص<C9B5> <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD>\n");
|
|
|
|
|
printf(" %d\t %d\t %s\t %s %s %s %.2f\t%d\n",
|
|
|
|
|
p->FlightNum,p->MaxFare,p->StartPlace,p->EndPlace,p->StartDate,p->EndDate,p->price,p->currentFareNum);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int mode = 0,num = 0;
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1.<2E><> 2.<2E><><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
if (mode != 1 && mode != 2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (mode == 1)
|
|
|
|
|
{
|
|
|
|
|
int num = 0;
|
|
|
|
|
if (p->currentFareNum == p->MaxFare)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰ<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣡\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
if (!(scanf("%d",&num)))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (num > (p->MaxFare-p->currentFareNum))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
printf("Ʊ<EFBFBD><EFBFBD>:%.2f <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1.<2E><> 2.<2E><>\n",(p->price*num));
|
|
|
|
|
scanf("%d",&mode);
|
|
|
|
|
if (mode != 1 && mode != 2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
while(getchar() != '\n'); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
system("pause");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<EFBFBD><EFBFBD><EFBFBD>죡\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
q->SeatNumber = num;
|
|
|
|
|
p->currentFareNum +=num;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModeExitSystem(void)
|
|
|
|
|
{
|
|
|
|
|
FILE* FlightFp = fopen(".\\FlightInfo.txt","w");
|
|
|
|
|
FILE* pareFp = fopen(".\\PareInfo.txt","w");
|
|
|
|
|
if(FlightFp == NULL || pareFp == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("open file failed!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
WriteFlightInfo(FlightFp);
|
|
|
|
|
WritePareInfo(pareFp);
|
|
|
|
|
|
|
|
|
|
fclose(FlightFp);
|
|
|
|
|
fclose(pareFp);
|
|
|
|
|
FlightDeleteAllNode(); //ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
FareDeleteAllNode(); //ɾ<><C9BE><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ӭ<EFBFBD>´ι<EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlightList* FlightMallocFunc(void)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѿռ<D1BF>
|
|
|
|
|
{
|
|
|
|
|
FlightList* node = malloc(sizeof(FlightList));
|
|
|
|
|
if(node == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("malloc failed!\n");
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FareList* FareMallocFunc(void)//<2F>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѿռ<D1BF>
|
|
|
|
|
{
|
|
|
|
|
FareList* node = malloc(sizeof(FareList));
|
|
|
|
|
if(node == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("malloc failed!\n");
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlightList* FlightCreateNewNode(void)//<2F><><EFBFBD>ഴ<EFBFBD><E0B4B4><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
{
|
|
|
|
|
FlightList *node = FlightMallocFunc();
|
|
|
|
|
node->next = node->prev = node;
|
|
|
|
|
FlightInsertNode(FlightHead->prev, node ,FlightHead);
|
|
|
|
|
FlightNum++;
|
|
|
|
|
node->FlightNum = 0;
|
|
|
|
|
node->MaxFare = 0;
|
|
|
|
|
memset(node->StartDate, 0, sizeof(node->StartDate));
|
|
|
|
|
memset(node->EndPlace, 0, sizeof(node->EndPlace));
|
|
|
|
|
memset(node->StartDate, 0, sizeof(node->StartDate));
|
|
|
|
|
memset(node->EndDate, 0, sizeof(node->EndDate));
|
|
|
|
|
node->price = 0;
|
|
|
|
|
node->currentFareNum = 0;
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FareList* FareCreateNewNode(void)//<2F>˿ʹ<CBBF><CDB4><EFBFBD><EFBFBD>½ڵ<C2BD>
|
|
|
|
|
{
|
|
|
|
|
FareList *node = FareMallocFunc();
|
|
|
|
|
node->next = node->prev = node;
|
|
|
|
|
FareInsertNode(FareHead->prev, node ,FareHead);
|
|
|
|
|
FareNum++;
|
|
|
|
|
node->FlightNum = 0;
|
|
|
|
|
memset(node->IDnumber, 0, sizeof(node->IDnumber));
|
|
|
|
|
memset(node->name, 0, sizeof(node->name));
|
|
|
|
|
memset(node->gender, 0, sizeof(node->gender));
|
|
|
|
|
memset(node->birthDate, 0, sizeof(node->birthDate));
|
|
|
|
|
node->SeatNumber = 0;
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FlightInsertNode(FlightList *h_node, FlightList *node, FlightList *n_node)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ڵ<C2BD><DAB5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
{
|
|
|
|
|
h_node->next = node;
|
|
|
|
|
node->prev = h_node;
|
|
|
|
|
node->next = n_node;
|
|
|
|
|
n_node->prev = node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FareInsertNode(FareList *h_node, FareList *node, FareList *n_node)//<2F>˿͵<CBBF><CDB5><EFBFBD><EFBFBD>½ڵ<C2BD><DAB5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
{
|
|
|
|
|
h_node->next = node;
|
|
|
|
|
node->prev = h_node;
|
|
|
|
|
node->next = n_node;
|
|
|
|
|
n_node->prev = node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FlightDeleteAllNode(void)//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
{
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
FlightList* p = FlightHead->next;
|
|
|
|
|
p->prev->next = p->next;
|
|
|
|
|
p->next->prev = p->prev;
|
|
|
|
|
free(p);
|
|
|
|
|
if(FlightHead->next = FlightHead)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
free(FlightHead);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FareDeleteAllNode(void)//ɾ<><C9BE><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD>нڵ<D0BD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
FareList* p = FareHead->next;
|
|
|
|
|
p->prev->next = p->next;
|
|
|
|
|
p->next->prev = p->prev;
|
|
|
|
|
free(p);
|
|
|
|
|
if(FareHead->next = FareHead)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
free(FareHead);
|
|
|
|
|
}
|