预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共12页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

#include<windows.h> #include<iostream> #include<fstream> #include<iomanip> #include<conio.h> usingnamespacestd; #defineN20//车辆最大存储量20 #defineOilPrice8.0//油价8元每升 classManager; classCars { private: intnum;//编号 intpnum;//车牌号 charmade[20];//制造公司 doubletime;//购买时间(多少个月) inttype;//型号(1-大客车,2-小轿车,3-卡车) doublekm;//总公里数 intcost;//基本维护费用 intRoadFee;//养路费 doubleOilKm;//耗油量/公里 doubleAllCount;//累计总费用 friendManager; }; classManager { private: Carscar[N]; intpeople[N];//最大载客量(大客车) intcoach[N];//箱数(小轿车) intweight[N];//载重量(卡车) inttop;//记录当前车辆数量 public: Manager(){top=0;}//车辆初始值为0 voidadd();//添加车辆 voidsearch();//查询车辆 voidshow();//显示车辆信息库 voidedit();//编辑功能 voiddelet();//删除车辆 voidsum();//统计信息 voidread();//读出车辆信息 voidwrite();//车辆信息存盘 voidjiemian();//总界面 }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// voidManager::add()//////////添加车辆 { inta=0,x,y; while(1) { if(top<N) { cout<<"请输入需添加的车辆信息"<<endl; cout<<"车辆编号:"; cin>>x; for(intj=0;j<top;j++) { if(car[j].num==x)//编号重复 { cout<<"编号重复,添加失败!即将跳转至功能主界面"<<endl; a++; break; } } if(a==0)//此时编号不重复 { car[top].num=x; cout<<"车牌号:"; cin>>car[top].pnum; cout<<"车辆制造公司:"; cin>>car[top].made; cout<<"购买时间:"; cin>>car[top].time; cout<<"养路费:"; cin>>car[top].RoadFee; cout<<"车辆型号(1-大客车,2-小轿车,3-卡车):"; cin>>car[top].type; while(!(car[top].type==1||car[top].type==2||car[top].type==3))//判断输入指令是否为1-3 { cout<<"输入指令号错误,重输:"; cin>>car[top].type; } cout<<"总公里数:"; cin>>car[top].km; if(car[top].type==1)//此时是1-大客车 { cout<<"最大载客量:"; cin>>people[top]; car[top].cost=2000; car[top].OilKm=0.1; } elseif(car[top].type==2)//此时是2-小轿车 { cout<<"车厢数:"; cin>>coach[top]; car[top].cost=1000; car[top].OilKm=0.05; } else//此时是3-卡车 { cout<<"载重量:"; cin>>weight[top]; car[top].cost=1500; car[top].OilKm=0.15; } car[top].AllCount=(OilPrice*car[top].OilKm*car[top].km)+(car[top].time*c