1、可实现功能(思维导图一览)
注:普通用户账号:user 密码:123456
普通用户账号:admin 密码:123456
班期输入格式为:2024 3 20
航班号唯一,时间为24小时制,输入格式为:17 28
2.fly.h代码
#define _CRT_SECURE_NO_WARNINGS 1
#ifndef _FLY_H_
#define _FLY_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <conio.h>
// 班期信息结构体
struct schedule
{
int year;
int moth;
int day;
};
// 时间信息结构体
struct time
{
int hours;
int min;
};
// 航班信息结构体
typedef struct flight_new
{
char number[10]; // 航班号
char staddress[10]; // 起点站
char arraddress[10]; // 终点站
struct schedule data; // 班期
char type[10]; // 机型
struct time stime; // 起飞时间
struct time atime; // 达到时间
float price; // 票价
}flight_new;
// 航班管理结构体(节点信息)
typedef struct flight
{
flight_new datas; // 航班的信息数据
struct flight* prev; //记录前驱的地址
struct flight* next; //记录后继的地址
}flight;
// 管理结构体(头结点)
typedef struct headnode
{
int numbers; //记录有多少条信息
flight* head; //记录首结点的地址
flight* tail; //记录尾结点的地址
}headnode;
/*
* brief: 初始化航班信息链表头节点信息
* param: None
* return: the type is struct headnode*
*/
struct headnode* flight_create_headnode();
/*
* brief: 初始化航班信息(新节点)
* param: the type is struct flight_new
* return: the type is struct flight*
*/
struct flight* flight_create_node(struct flight_new fly);
/*
* brief: 将新航班信息尾插到链表(创建链表)
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_addtailnode(headnode* head_node);
/*
* brief: 根据航班号删除信息
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_delnode(headnode* head_node);
/*
* brief: 根据航班号查找航班信息
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_findnumber(headnode* head_node);
/*
* brief: 航班信息修改系统
* param: the type is struct headnode*
* return: None
*/
void flight_modify(headnode* head_node);
/*
* brief: 根据航班号修改票价
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_modify_price(headnode* head_node);
/*
* brief: 根据航班号修改起点站
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_modify_staddress(headnode* head_node);
/*
* brief: 根据航班号修改终点站
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_modify_arraddress(headnode* head_node);
/*
* brief: 打印所有航班信息
* param: the type is struct headnode*
* return: 成功返回:ture 失败返回:false
*/
bool flight_print(headnode* head_node);
/*
* brief: 系统界面(管理员)
* param: None
* return: None
*/
void flight_mean_admin();
/*
* brief: 修改系统界面(管理员)
* param: None
* return: None
*/
void flight_Modify_mean();
/*
* brief: 航班信息管理系统(管理员)
* param: the type is struct headnode*
* return: None
*/
void flight_manage_admin(headnode* head_node);
/*
* brief: 航班系统登录界面
* param: None
* return: None
*/
void flight_login_mean();
/*
* brief: 管理员登录系统
* param: the type is struct headnode*
* return: None
*/
void flight_login_admin(headnode* head_node);
/*
* brief: 系统界面(普通用户)
* param: None
* return: None
*/
void flight_mean_user();
/*
* brief: 普通用户登录系统
* param: the type is struct headnode*
* return: None
*/
void flight_login_user(headnode* head_node);
/*
* brief: 航班信息管理系统(普通用户)
* param: the type is struct headnode*
* return: None
*/
void flight_manage_user(headnode* head_node);
/*
* brief: 根据起点站查询航班信息
* param: the type is struct headnode*
* return: None
*/
void flight_findstaddress(headnode* head_node);
/*
* brief: 查询系统界面(管理员)
* param: None
* return: None
*/
void flight_find_mean();
/*
* brief: 根据终点站查询航班信息
* param: the type is struct headnode*
* return: None
*/
void flight_findarraddress(headnode* head_node);
/*
* brief: 根据机型查询航班信息
* param: the type is struct headnode*
* return: None
*/
void flight_findtype(headnode* head_node);
#endif
3、fly.c代码
#include "fly.h"
// 初始化航班信息链表头节点信息
struct headnode* flight_create_headnode()
{
// 为头节点申请空间
struct headnode* head_node = malloc(sizeof(headnode));
if (head_node == NULL)
return NULL;
// 初始化头节点
head_node->numbers = 0;
head_node->head = NULL;
head_node->tail = NULL;
return head_node;
}
//------------------------------
// 初始化航班信息(新节点)
struct flight* flight_create_node(struct flight_new fly)
{
// 为新节点申请空间
struct flight* new_node = malloc(sizeof(flight));
if (n