#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include<string>
#include"Base_class.h"
//#include"0建立轿车的链表.cpp"
//#include"0建立货车的链表.cpp"
//#include"0建立客车的链表.cpp"
//#include"1添加新的轿车.cpp"
//#include"1添加新的货车.cpp"
//#include"1添加新的客车.cpp"
//#include"2.0按公司查询轿车.cpp"
//#include"2.0按公司查找货车.cpp"
//#include"2.0按公司查找客车.cpp"
//#include"2.1按编号查找货车.cpp"
//#include"2.1按编号查找客车.cpp"
//#include"2.1按编号查询轿车.cpp"
//#include"2.2按汽车种类查找.cpp"
//#include"3显示车辆信息库.cpp"
//#include"4编辑轿车信息.cpp"
//#include"4编辑货车信息.cpp"
//#include"4编辑客车信息.cpp"
//#include"5删除轿车.cpp"
//#include"5删除货车.cpp"
//#include"5删除客车.cpp"
//#include"6统计信息.cpp"
using namespace std;
int main()
{
void all_num(pcar pcar_link, ptruck ptruck_link, pcoach pcoach_link);
pcoach delete_num_coach(int num_c, pcoach pcoach_link);
ptruck delete_num_truck(int num_c, ptruck ptruck_link);
pcar delete_num_car(int num_c, pcar pcar_link);
pcoach change_coach(pcoach pcoach_link);
ptruck change_truck(ptruck ptruck_link);
pcar change_car(pcar pcar_link);
void display_all(pcar pcar_link, ptruck ptruck_link, pcoach pcoach_link);
void search_num_coach(int num_c, pcoach pcoach_link);
void search_num_truck(int num_c, ptruck ptruck_link);
void search_num_car(int num_c, pcar pcar_link);
void search_company_coach(string company_c, pcoach pcoach_link);
void search_company_truck(string company_c, ptruck ptruck_link);
void search_company_car(string company_c, pcar pcar_link);
void search_Auto(int x, pcar pcar_link, ptruck ptruck_link, pcoach pcoach_link);
void plus_coach(pcoach pcoach_link, int num, double kilometer, double fule_pre_kilo, double fix_fee, double road_fee, double total_fee, string num_plate,
string model, string bought_time, string company, int people_num);
void plus_truck(ptruck ptruck_link, int num, double kilometer, double fule_pre_kilo, double fix_fee, double road_fee, double total_fee, string num_plate,
string model, string bought_time, string company, double load_num);
void plus_car(pcar pcar_link, int num, double kilometer, double fule_pre_kilo, double fix_fee, double road_fee, double total_fee, string num_plate,
string model, string bought_time, string company, int box_num);
pcar link_car();
ptruck link_truck();
pcoach link_coach();
pcar pcar_link=NULL;
ptruck ptruck_link = NULL;
pcoach pcoach_link = NULL;
int num, box_num, people_num, i;
double kilometer, fule_pre_kilo, fix_fee, road_fee, total_fee, load_num;
string num_plate, model, bought_time, company;
pcar_link = link_car();
ptruck_link = link_truck();
pcoach_link = link_coach();
start:
cout << "请选择您的操作:" << endl;
cout << "1、添加车辆 2、查询车辆 3、显示车辆信息库 4、编辑车辆 5、删除车辆 6、统计车辆信息 7、车辆信息存盘 8、从文件中读取车辆信息" << endl;
cin >> i;
switch (i)
{
case 1:
cout << "请选择你要添加的车辆类型:1、轿车 2、货车 3、客车" << endl;
int i1;
cin >> i1;
if (i1 == 1)
{
cout << "请依次输入轿车编号、公里数、每公里耗油量、维修费用、路费、车牌号、汽车品牌、车型、购买时间、厢数";
cin >> num >> kilometer >> fule_pre_kilo >> fix_fee >> road_fee >> num_plate >> company >> model >> bought_time >> box_num;
total_fee = kilometer * fule_pre_kilo + fix_fee + road_fee;
plus_car(pcar_link, num, kilometer, fule_pre_kilo, fix_fee, road_fee, total_fee, num_plate,
model, bought_time, company, box_num);
}
else if (i1 == 2)
{
cout << "请依次输入货车编号、公里数、每公里耗油量、维修费用、路费、车牌号、汽车品牌、车型、购买时间、载重量";
cin >> num >> kilometer >> fule_pre_kilo >> fix_fee >> road_fee >> num_plate >> company >> model >> bought_time >> load_num;
total_fee = kilometer * fule_pre_kilo + fix_fee + road_fee;
plus_truck(ptruck_link, num, kilometer, fule_pre_kilo, fix_fee, road_fee, total_fee, num_plate,
model, bought_time, company, load_num);
}
else if (i1 == 3)
{
cout << "请依次输入客车编号、公里数、每公里耗油量、维修费用、路费、车牌号、汽车品牌、车型、购买时间、载人量";
cin >> num >> kilometer >> fule_pre_kilo >> fix_fee >> road_fee >> num_plate >> company >> model >> bought_time >> people_num;
total_fee = kilometer * fule_pre_kilo + fix_fee + road_fee;
plus_coach(pcoach_link, num, kilometer, fule_pre_kilo, fix_fee, road_fee, total_fee, num_plate,
model, bought_time, company, people_num);
}
else
{
cout << "输入错误,请重新输入" << endl;
}
goto start;
break;
case 2:
cout << "请输入您要查询的车辆种类:1、轿车 2、货车 3、客车" << endl;
int i22;
cin >> i22;
cout << "是否显示该种类全部车辆? 1、是 2、按公司查找 3、按编号查找" << endl;
int i21;
cin >> i21;
switch (i21)
{
case 1:
search_Auto(i22, pcar_link, ptruck_link, pcoach_link);
break;
case 2:
if (i22 == 1)
{
cout << "请输入汽车公司:" << endl;
cin >> company;
search_company_car(company, pcar_link);
}
else if (i22 == 2)
{
cout << "请输入汽车公司:" << endl;
cin >> company;
search_company_truck(company, ptruck_link);
}
else if (i22 == 3)
{
cout << "请输入汽车公司:" << endl;
cin >> company;
search_company_coach(company, pcoach_link);
}
goto start;
break;
case 3:
if (i22 == 1)
{
cout << "请输入车辆编号" << endl;
cin >> num;
search_num_car(num, pcar_link);
}
else if (i22 == 2)
{
cout << "请输入车辆编号" << endl;
cin >> num;
search_num_truck(num, ptruck_link);
}
else if (i22 == 3)
{
cout << "请输入车辆编号" << endl;
cin >> num;
search_num_coach(num, pcoach_link);
}
break;
}
goto start;
break;
case 3:
display_all(pcar_link, ptruck_link, pcoach_link);
goto start;
break;
case 4:
cout << "请输入编辑的汽车种类:1、轿车 2、货车 3、客车" << endl;
int i3;
cin >> i3;
if (i3 == 1)
{
change_car(pcar_link);
}
else if (i3 == 2)
{
change_truck(ptruck_link);
}
else if (i3 == 3)
{
change_coach(pcoach_link);
}
goto start;
break;
case 5:
cout << "请选择你要删除的汽车种类:1、轿车 2、货车 3、客车" << endl;
int i4;
cin >> i4;
if (i4 == 1)
{
cout << "请输入汽车编号:" << endl;
cin >> num;
delete_num_car(num, pcar_link);
}
else if (i4 == 2)
{
cout << "请输入汽车编号:" << endl;
cin >> num;
delete_num_truck(num, ptruck_link);
}
else if (i4 == 3)
{
cout << "请输入汽车编号:" << endl;
cin >> num;
delete_num_coach(num, pcoach_link);
}
goto start;
break;
case 6:
all_num(pcar_link, ptruck_link, pcoach_link);
}
return 0;
}