飞机订票系统(c语言)

这篇具有很好参考价值的文章主要介绍了飞机订票系统(c语言)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、项目背景

​ 为了免去在窗口排队买票的麻烦,飞机订票系统应运而生。用户通过该系统可以快速,详细地了解需要的信息,并提供了一个很好的购票渠道。

二、设计目的

  • 如何合理设计不同数据结构来存储航班信息、旅客信息、订票信息等不同数据
  • 如何合理设计不同的链表节点来封装不同的实体信息;
  • 如何合理设计多个链表结构来管理不同实体的若干记录;
  • 进一步强化学习链表的创建、插入、查找、修改和删除等基本操作;
  • 进一步强化学习内存中链表数据和外部文件之间的存取操作;
  • 如何利用time.h中的函数获取系统日期时间

三、项目功能需求

1、添加机票信息

  • 能够添加机票的航班号、起飞降落时间、目的地、出发地、票价、可定的剩余票数以及折扣信息等。

2、查询可预订的机票信息

  • 能够根据用户的具体需求即航班号或目的地,查询可定的机票并输出相应的机票信息,支持标准格式输出多条机票信息。

3、预定机票并输入个人信息

  • 查询机票后,根据用户的选择,决定是否订票,并输入信息。

4、修改机票信息

  • 能修改已经存在的机票信息。

5、退票

6、根据目的地和最早出发时间,系统可以推荐合适的机票信息

7、显示当前时间

四、系统的功能结构图

飞机订票系统(c语言)

五、功能模块介绍

1、添加模块

  • 可以连续添加多条航班信息,包括航班号、出发城市、到达城市、出发时间、到达时间、票价、折扣信息、票数

2、查找模块

  • 用户在订票之前需要先查询满足自己出行需要的机票信息,本功能模块支持按照“航班号”查询和按照“目的地”查询两种方式

3、订票模块

  • 输入目的地信息,可以输出所有满足该目的地的航班信息,并提示用户是否订票

4、修改模块

  • 输入需要修改的航班号,可以修改航班信息

5、退票模块

  • 能支持用户退票操作

6、显示模块

  • 显示模块可以展示所有航班信息,供旅客查看选择

7、推荐模块

  • 推荐模块的功能是根据旅客输入的目的地信息和最早出发时间,向旅客推荐满足要求的航班信息,帮助旅客快速搜索符合时间要求的航班

8、保存模块

  • 能将航班信息和旅客订票信息保存到磁盘文件中,再次启动系统时,则可以自动读取文件中的航班信息和旅客订票信息

9、时间模块

  • 支持实时查询当前时间功能

六、详细设计

1、主函数

功能设计文章来源地址https://www.toymoban.com/news/detail-475230.html

  • 主函数用于实现主菜单的显示,并响应用户对菜单项的选择。
  • 本系统的主函数主要两大功能:保存信息和菜单选择。
  • 某个功能执行完之后,还能按任意键自动回到主菜单,便于用户进行其他操作。

2、添加模块

功能设计

  • 用于对飞机班次,始发地,目的地,起飞时间,降落时间,票价,折扣以及所剩票数等信息的输入与保存。

添加模块流程图

飞机订票系统(c语言)

3、查找模块

功能设计

  • 用于根据输入的飞机班次或到达城市来进行查找,了解航班的信息。
  • 提供了两种查询方式:一是根据飞机班次查询,二是根据到达城市查询。

4、订票模块

功能设计

  • 用于根据用户输入的城市进行查询,在屏幕上显示满足条件的飞机班次信息。
  • 从中选择自己想要预定的机票,并根据提示输入个人信息。

5、修改模块

功能设计

  • 用于对已添加的飞机班次,时间,地点,票价等信息的修改。

6、退票模块

功能设计

  • 用于用户对已经预定的飞机票进行退票。

7、显示模块

功能设计

  • 用于对输入的航班信息和经过修改的航班信息进行整理输出,方便用户查看。

8、推荐模块

功能设计

  • 用于对用户提供的信息,系统检索后提供合适的机票,以便用户选择适合自己时间的班次后进行预订。

9、保存模块

功能设计

  • 应用文件处理来将航班信息和订票人信息保存到指定的磁盘文件中。

10、时间模块

功能设计

  • 为了更好地方便用户订票时的实际需求,本系统提供了查询当地时间的功能。

七、代码

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <time.h>
#define HEAD1 " *************************Airplane Ticket Booking*****************************\n"
#define HEAD2 " |  Flight  |Start City| Dest City|DepartureTime|ArrivalTime|price  | number |\n"
#define HEAD3 " |----------|----------|----------|-------------|-----------|-------|--------|\n"
#define FORMAT  " |%-10s|%-10s|%-10s|%-12s |%-10s | %-.2f|  %4d  |\n"
#define DATA  pst->stData.acFlight,pst->stData.acOrigin,pst->stData.acDest,pst->stData.acTakeOffTime,pst->stData.acReceiveTime,pst->stData.fPrice,pst->stData.iNum


int iSave = 0;
/**************************************
定义飞机票信息以及订票人的信息相关结构体
**************************************/

/*定义储存机票的结构体*/
struct AirPlane
{
	char acFlight[10];   /*航班号*/
	char acOrigin[10];   /*出发地*/
	char acDest[10];     /*目的地*/
	char acTakeOffTime[10];  /*起飞时间*/
	char acReceiveTime[10];  /*降落时间*/
	float fPrice;        /*票价*/
	char acDiscount[4];     /*折扣*/
	int iNum;            /*剩余票数*/

};


/*定义购票者信息的结构体*/
struct Man
{
	char acName[20];   /*姓名*/
	char acID[20];     /*身份证号*/
	char acSex[2];	  /*性别*/
	int iBookNum;     /*购票数*/
	char acBookFlight[10];   /*订购航班号*/
};


/*定义机票信息节点的结构体*/
struct PlaneNode
{
	struct AirPlane stData;
	struct PlaneNode *pstNext;
};

/*定义订票人信息节点的结构体*/
struct ManNode
{
	struct Man stData;
	struct ManNode *pstNext;
};

/*定义相关表头打印函数*/
void PrintHead()
{
	printf(HEAD1);
	printf(HEAD2);
	printf(HEAD3);
}
void PrintData(struct PlaneNode*stLp)
{
	struct PlaneNode *pst = stLp;
	printf(FORMAT, DATA);
}

/*菜单界面*/
void Menu()
{
	puts("**************************************************");
	puts("* Welcome to the airplane tickets booking system *");
	puts("*------------------------------------------------*");
	puts("*    choose the following operations(0-9);       *");
	puts("*------------------------------------------------*");
	puts("*   1.Insert flights    2.Search flights         *");
	puts("*   3.Book tickets      4.Modify flight data     *");
	puts("*   5.Show flights      6.Recommend flights      *");
	puts("*   7.Refund tickets    8.Show current time      *");
	puts("*   9.Save to files     0.quit                   *");
	puts("**************************************************");
}
/*显示时间函数*/
void NowTime()
{
	time_t lt;
	lt = time(NULL);
	printf("现在的时间是:%s\n", ctime(&lt));
}

/*添加机票函数*/
void Insert(struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstHead,*pstTail, *pstCur, *pstNew;
	char acFlight[10];
	pstHead = pstTail = pstPlaneNodeHead;
	while (pstTail->pstNext != NULL)
	{
		pstTail = pstTail->pstNext;  /*让ptail指向最后一个节点*/
	}
	while (1)
	{
		printf("Input the new flight number(-1 to end):");
		scanf("%s", acFlight);
		if (strcmp(acFlight, "-1") == 0)
			break;
		pstCur = pstPlaneNodeHead->pstNext;
		while (pstCur != NULL)
		{
			if (strcmp(acFlight, pstCur->stData.acFlight) == 0)
			{
				printf("this flight %s exists!\n", acFlight);
				return;/*如果航班号已存在,则返回*/
			}
			pstCur = pstCur->pstNext;
		}
		/*如果航班号没有和现有记录中的航班号重复,则新建一个链表节点*/
		pstNew = (struct PlaneNode*)malloc(sizeof(struct PlaneNode));
		strcpy(pstNew->stData.acFlight, acFlight);
		printf("Input the Start City:\n");
		scanf("%s", pstNew->stData.acOrigin);
		printf("Input the Dest City:\n");
		scanf("%s", pstNew->stData.acDest);
		printf("Input the Departure Time (Format 00:00):\n");
		scanf("%s", pstNew->stData.acTakeOffTime);
		printf("Input the Arrival Time (Format 00:00):\n");
		scanf("%s", pstNew->stData.acReceiveTime);
		printf("Input the price of ticket:\n");
		scanf("%f", &pstNew->stData.fPrice);
		printf("Input the discount (Format 0.0):\n");
		scanf("%s", pstNew->stData.acDiscount);
		printf("Input the number of the tickets:\n");
		scanf("%d", &pstNew->stData.iNum);
		pstNew->pstNext = NULL;
		pstTail->pstNext = pstNew;
		pstTail = pstNew;
		iSave = 1;/*有新的航班信息,保存标志置为1,若退出需提示是否保存信息*/
	}
}


/*查找机票函数*/
void Search(struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstPlaneNode;
	int iSel = 0, iCount = 0;
	char acFlight[10], acDest[10];
	pstPlaneNode = pstPlaneNodeHead->pstNext;
	if (pstPlaneNode == NULL)
	{
		printf("No flight record!\n");
		return;
	}
	printf("Choose one way according to:\n1.flight number;\n2.Dest:\n");
	scanf("%d", &iSel);
	
	if (iSel == 1)
	{
		printf("Input the flight number:");
		scanf("%s", acFlight);
		PrintHead();
		while (pstPlaneNode != NULL)
		{
			if (strcmp(pstPlaneNode->stData.acFlight, acFlight) == 0)
			{
				PrintData(pstPlaneNode);
				break;/*由于航班号是唯一的,找到一条即可退出*/
			}
			else
				pstPlaneNode = pstPlaneNode->pstNext;
		}
		/*遍历一遍,均没有中途break,则提示用户没有记录*/
		if (pstPlaneNode == NULL)
			printf("Sorry, no record!\n");

	}
	else if (iSel == 2)
	{
		printf("Input the Dest City:");
		scanf("%s", acDest);
		PrintHead();
		while (pstPlaneNode != NULL)
		{
			if (strcmp(pstPlaneNode->stData.acDest, acDest) == 0)
			{
				/*由于相同目的地的航班可能是多条,所以需要遍历完整个链表*/
				PrintData(pstPlaneNode);
				iCount++;
			}
			pstPlaneNode = pstPlaneNode->pstNext;
		}
		if (iCount == 0)/*如果记录数仍为0,则提示用户没有记录*/
			printf("Sorry, no record!\n");
	}
	else
	{
		printf("Sorry, please input right number:1-2\n");
		return;
	}
}

/*订票函数*/

void Book(struct ManNode* pstManNodeHead, struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstPlaneNodeCur, *astPlaneNode[10]; /*定义临时指针和指针数组*/
	struct ManNode *pstManNodeCur, *pstManNodeTemp = 0;
	char acDest[10], acID[20], acName[20], acSex[2], acDecision[2], acFlight[10];
	/*iNum表示预定票数,iRecord记录符合要求的航班数*/
	int iNum = 0, iRecord = 0, k = 0, iFlag = 0;
	pstManNodeCur = pstManNodeHead;/*接收订票人信息链表的头指针*/
	while (pstManNodeCur->pstNext != NULL)
		pstManNodeCur = pstManNodeCur->pstNext;
	printf("Input the Dest City:\n");
	scanf("%s", acDest);/*输入目的地*/
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	while (pstPlaneNodeCur != NULL)/*循环条件为链表不为空*/
	{
		if (strcmp(pstPlaneNodeCur->stData.acDest, acDest) == 0)/*比较目的地*/
		{
			astPlaneNode[iRecord++] = pstPlaneNodeCur;/*目的地吻合的节点地址存到指针数组中*/
		}
		pstPlaneNodeCur = pstPlaneNodeCur->pstNext;/*指针后移*/
	}
	printf("\nthere are %d flight you can choose!\n", iRecord);
	PrintHead();/*输出表头*/
	for (k = 0; k < iRecord; k++)/*循环输出指针数组中的指针指向的航班信息*/
		PrintData(astPlaneNode[k]);
	if (iRecord == 0)/*若记录为0,表示没有符合条件的航班*/
		printf("sorry,no flight you can book!\n");
	else
	{
		printf("do you want to book it<y(Y)/n(N)>?\n");/*提示用户是否预定*/
		scanf("%s", acDecision);
		getchar(); /*提取多余的回车符,否则下面输入姓名的gets函数将获得一个回车符*/
		if (strcmp(acDecision, "y") == 0 || strcmp(acDecision, "Y") == 0)
		{
			printf("Input your information!\n");/*输入订票的详细信息*/
			pstManNodeTemp = (struct ManNode*)malloc(sizeof(struct ManNode));
			printf("Input your name:");
			gets(acName);/*由于姓和名中间会有空格,只能用gets函数,不能用scanf结合%s*/
			strcpy(pstManNodeTemp->stData.acName, acName);
			printf("Input your id:");
			scanf("%s", acID);
			strcpy(pstManNodeTemp->stData.acID, acID);
			printf("Input your sex (M/F):");
			scanf("%s", acSex);
			strcpy(pstManNodeTemp->stData.acSex, acSex);
			printf("Input the flight number:");
			scanf("%s", acFlight);
			strcpy(pstManNodeTemp->stData.acBookFlight, acFlight);
			for (k = 0; k<iRecord; k++)
			if (strcmp(astPlaneNode[k]->stData.acFlight, acFlight) == 0)
			{
				if (astPlaneNode[k]->stData.iNum < 1)/*判断是否有剩余的票*/
				{
					printf("no ticket!");
					return;
				}
				printf("remain %d tickets\n", astPlaneNode[k]->stData.iNum);
				iFlag = 1;
				break;
			}
			if (iFlag == 0)
			{
				printf("error");
				return;
			}
			printf("Input the book number:");
			scanf("%d", &iNum);/*输入预定的票数,剩余票数相应减少*/
			astPlaneNode[k]->stData.iNum = astPlaneNode[k]->stData.iNum - iNum;
			pstManNodeTemp->stData.iBookNum = iNum;
			pstManNodeCur->pstNext = pstManNodeTemp;
			pstManNodeTemp->pstNext = NULL;
			pstManNodeCur = pstManNodeTemp;
			printf("success!\n");
			iSave = 1;
		}
	}
}
struct ManNode *FindMan(struct ManNode* pstManNodeHead, char acID[20])
{
	struct ManNode *pstManNodeCur;
	pstManNodeCur = pstManNodeHead->pstNext;
	while (pstManNodeCur)
	{
		if (strcmp(pstManNodeCur->stData.acID, acID) == 0)
		{
			return pstManNodeCur;
		}
		pstManNodeCur = pstManNodeCur->pstNext;
	}
	return NULL;
}

struct PlaneNode *FindPlane(struct PlaneNode* pstPlaneNodeHead, char acFlight[10])
{
	struct PlaneNode *pstPlaneNodeCur;
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	while (pstPlaneNodeCur)
	{
		if (strcmp(pstPlaneNodeCur->stData.acFlight, acFlight) == 0)
		{
			//iMark = 1;
			return pstPlaneNodeCur;
		}
		pstPlaneNodeCur = pstPlaneNodeCur->pstNext;
	}
	return NULL;
}


/*退票系统*/
void Refund(struct ManNode* pstManNodeHead, struct PlaneNode* pstPlaneNodeHead)
{
	struct ManNode *pstManNodeCur, *pstManNodeFind = 0;
	struct PlaneNode *pstPlaneNodeFind = 0;
	char acID[20], acDecision[2];
	int iNum, iBookNum;
	
	printf("\nInput your ID:");
	scanf("%s", acID);
	pstManNodeFind = FindMan(pstManNodeHead, acID);
	if (pstManNodeFind == NULL)
		printf("can't find!\n");
	else  /*找到了相应的旅客订票信息*/
	{
		printf("\t\tthis is your tickets:\n");
		printf("id number:%s\n", pstManNodeFind->stData.acID);
		printf("name:%s\n", pstManNodeFind->stData.acName);
		printf("sex:%s\n", pstManNodeFind->stData.acSex);
		printf("book flight:%s\n",pstManNodeFind->stData.acBookFlight);
		printf("book number:%d\n", pstManNodeFind->stData.iBookNum);
		
		printf("do you want to cancel it?<y/n>");
		scanf("%s", acDecision);
		if (strcmp(acDecision, "y") == 0 || strcmp(acDecision, "Y") == 0)
		{
			/*将pstManNodeCur定位到指向pstManNodeFind前面那个节点*/
			pstManNodeCur = pstManNodeHead;
			while (pstManNodeCur->pstNext != pstManNodeFind)
				pstManNodeCur = pstManNodeCur->pstNext;
			/*找到该旅客订票信息中对应的航班记录*/
			pstPlaneNodeFind = FindPlane(pstPlaneNodeHead, pstManNodeFind->stData.acBookFlight);
			if (pstPlaneNodeFind != NULL)/*退票后,对应航班的剩余票数相应增加*/
			{
				iNum = pstPlaneNodeFind->stData.iNum;
				iBookNum = pstManNodeFind->stData.iBookNum;
				pstPlaneNodeFind->stData.iNum = iNum + iBookNum;
			}				
			pstManNodeCur->pstNext = pstManNodeFind->pstNext;
			free(pstManNodeFind);/*释放该乘客订票记录的链表节点空间*/
			printf("successful!\n");
			/*航班信息有调整,保存标志置为1,退出系统时提示用户是否保存*/
			iSave = 1;
		}
	}
}


/*修改机票信息函数*/
void Modify(struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstPlaneNodeCur;
	char acFlight[10];
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	if (pstPlaneNodeCur == NULL)
	{
		printf("no flight to modify!\n");
		return;
	}
	else
	{
		printf("Input the flight number you want to modify:");
		scanf("%s", acFlight);
		while (pstPlaneNodeCur != NULL)
		{
			if (strcmp(pstPlaneNodeCur->stData.acFlight, acFlight) == 0)
				break;
			else
				pstPlaneNodeCur = pstPlaneNodeCur->pstNext;
		}
		if (pstPlaneNodeCur)
		{
			printf("Input new Start City:\n");
			scanf("%s", pstPlaneNodeCur->stData.acOrigin);
			printf("Input new Dest City:\n");
			scanf("%s", pstPlaneNodeCur->stData.acDest);
			printf("Input new Departure Time:\n");
			scanf("%s", pstPlaneNodeCur->stData.acTakeOffTime);
			printf("Input new Arrival Time:\n");
			scanf("%s", pstPlaneNodeCur->stData.acReceiveTime);
			printf("Input new price of ticket:\n");
			scanf("%f", &pstPlaneNodeCur->stData.fPrice);
			printf("Input new discount:\n");
			scanf("%s", pstPlaneNodeCur->stData.acDiscount);
			printf("Input new number of the tickets:\n");
			scanf("%d", &pstPlaneNodeCur->stData.iNum);
			printf("successful!\n");
			iSave = 1;
			return;
		}
		else
			printf("\tcan't find your ticket!\n");
	}
}

/*显示机票信息函数*/
void Show(struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstPlaneNodeCur;
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	PrintHead();
	if (pstPlaneNodeHead->pstNext == NULL)
	{
		printf("no flight ticket!\n");
	}
	else
	{
		while (pstPlaneNodeCur != NULL)
		{
			PrintData(pstPlaneNodeCur);
			pstPlaneNodeCur = pstPlaneNodeCur->pstNext;
		}
	}
}

/*快速终点站推荐机票函数*/
void Recommend(struct PlaneNode* pstPlaneNodeHead)
{
	struct PlaneNode *pstPlaneNodeCur;
	char acDest[10],acTime[10];
	int iNum = 0;
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	printf("Input your destination:");
	scanf("%s", acDest);
	printf("Input the earliest time you can take:");
	scanf("%s",acTime);
	PrintHead();
	while (pstPlaneNodeCur != NULL)
	{
		if (strcmp(pstPlaneNodeCur->stData.acDest, acDest) == 0)
		{
			if (strcmp(acTime, pstPlaneNodeCur->stData.acTakeOffTime) < 0)
			{
				PrintData(pstPlaneNodeCur);
				iNum++;
			}
		}
		pstPlaneNodeCur = pstPlaneNodeCur->pstNext;
	}
	printf("there are %d flight you can take!\n", iNum);
	if (iNum != 0)
	{
		printf("please choose 3rd operation to book it!\n");
	}
}


/*保存机票信息函数*/
void SavePlane(struct PlaneNode* pstPlaneNodeHead)
{
	FILE *pfPlane;
	struct PlaneNode *pstPlaneNodeCur;
	int iCount = 0, iFlag = 1;
	pfPlane = fopen("plane.txt", "wb");
	if (pfPlane == NULL)
	{
		printf("the file can't be opened!");
		return;
	}
	pstPlaneNodeCur = pstPlaneNodeHead->pstNext;
	while (pstPlaneNodeCur != NULL)
	{
		if (fwrite(pstPlaneNodeCur, sizeof(struct PlaneNode), 1, pfPlane) == 1)
		{
			pstPlaneNodeCur = pstPlaneNodeCur->pstNext;
			iCount++;
		}
		else
		{
			iFlag = 0;
			break;
		}
	}
	if (iFlag)
	{
		printf("you have save %d flights!\n", iCount);
		iSave = 0;
	}
	fclose(pfPlane);
}

/*保存订票人信息函数*/
void SaveMan(struct ManNode* pstManNodeHead)
{
	FILE *pfMan;
	struct ManNode *pstManNodeCur;
	int iCount = 0, iFlag = 1;
	pfMan = fopen("man.txt", "wb");
	if (pfMan == NULL)
	{
		printf("the file can't bo opened!");
		return;
	}
	pstManNodeCur = pstManNodeHead->pstNext;
	while (pstManNodeCur != NULL)
	{
		if (fwrite(pstManNodeCur, sizeof(struct ManNode), 1, pfMan) == 1)
		{
			pstManNodeCur = pstManNodeCur->pstNext;
			iCount++;
		}
		else
		{
			iFlag = 0;
			break;
		}
	}
}

int main()
{

	FILE *pfPlane, *pfMan;
	struct PlaneNode *pstPlaneNodeTemp, *pstPlaneNodeHead, *pstPlaneNodeCur;
	struct ManNode  *pstManNodeTemp, *pstManNodeHead, *pstManNodeCur;
	int iSel = 0;
	char c1;
	pstPlaneNodeHead = (struct PlaneNode*)malloc(sizeof(struct PlaneNode));
	pstPlaneNodeHead->pstNext = NULL;
	pstPlaneNodeCur = pstPlaneNodeHead;
	pstManNodeHead = (struct ManNode*)malloc(sizeof(struct ManNode));
	pstManNodeHead->pstNext = NULL;
	pstManNodeCur = pstManNodeHead;
	pfPlane = fopen("plane.txt", "ab+");
	if (pfPlane == NULL)
	{
		printf("can't open plane.txt!");
		return 0;
	}

	while (!feof(pfPlane))
	{
		pstPlaneNodeTemp = (struct PlaneNode*)malloc(sizeof(struct PlaneNode));
		if (fread(pstPlaneNodeTemp, sizeof(struct PlaneNode), 1, pfPlane) == 1)
		{
			pstPlaneNodeTemp->pstNext = NULL;
			pstPlaneNodeCur->pstNext = pstPlaneNodeTemp;
			pstPlaneNodeCur = pstPlaneNodeTemp;
		}
	}
	free(pstPlaneNodeTemp);
	fclose(pfPlane);
	pfMan = fopen("man.txt", "rb+");
	if (pfMan == NULL)
	{
		printf("can't open man.txt!");
		return 0;
	}

	while (!feof(pfMan))
	{
		pstManNodeTemp = (struct ManNode*)malloc(sizeof(struct ManNode));
		if (fread(pstPlaneNodeHead, sizeof(struct ManNode), 1, pfMan) == 1)
		{
			pstManNodeTemp->pstNext = NULL;
			pstManNodeCur->pstNext = pstManNodeTemp;
			pstManNodeCur = pstManNodeTemp;
		}
	}
	free(pstManNodeTemp);
	fclose(pfMan);
	while (1)
	{
		system("cls");
		Menu();
		printf("Input 0-9 operations:");
		scanf("%d", &iSel);
		getchar();/*取走数字后面多余的回车符*/
		system("cls");
		if (iSel == 0)
		{
			if (iSave == 1)
			{
				printf("do you want to save?<y/n>");
				scanf("%c", &c1);
				if (c1 == 'y' || c1 == 'Y')
				{
					SaveMan(pstManNodeHead);
					SavePlane(pstPlaneNodeHead);
				}

			}
			break;
		}
		switch (iSel)
		{
		case 1:Insert(pstPlaneNodeHead); break;
		case 2: Search(pstPlaneNodeHead); break;
		case 3: Book(pstManNodeHead, pstPlaneNodeHead); break;
		case 4:Modify(pstPlaneNodeHead); break;
		case 5:Show(pstPlaneNodeHead); break;
		case 6:Recommend(pstPlaneNodeHead); break;
		case 7:Refund(pstManNodeHead, pstPlaneNodeHead); break;
		case 8:NowTime(); break;
		case 9:SaveMan(pstManNodeHead); SavePlane(pstPlaneNodeHead); break;
		case 0:return 0;
		}
		printf("\nplease press any key to continue.......\n");
		getch();
	}
}

到了这里,关于飞机订票系统(c语言)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包