(完整word版)车辆管理系统源代码(C++).doc

#includewindows.h #includeiostream #includefstream #includeiomanip #includeconio.h using namespace std; #define N 20 #define OilPrice 8.0  // 车辆最大存储量 // 油价 8 元每升  20 class Manager; class Cars { private: int num; int pnum; char made[20]; double time; int type; double km;  // 编号 // 车牌号 // 制造公司 // 购买时间(多少个月) // 型号 (1- 大客车 ,2- 小轿车 // 总公里数  ,3- 卡车 ) int cost; int RoadFee; double OilKm;  // 基本维护费用 // 养路费 // 耗油量 / 公里 double AllCount;// 累计总费用 friend Manager; }; class Manager { private: Cars car[N]; int people[N]; // 最大载客量(大客车) int coach[N]; // 箱数(小轿车) int weight[N]; // 载重量(卡车) int top; // 记录当前车辆数量 public: Manager(){top = 0;}// 车辆初始值为 0 void add(); // 添加车辆 void search(); // 查询车辆 void show(); // 显示车辆信息库 void edit(); // 编辑功能 void delet(); // 删除车辆 void sum(); // 统计信息 void read(); // 读出车辆信息 void write(); // 车辆信息存盘 void jiemian(); // 总界面 }; //////////////////////////////////////////////////////////////////////////////////////////////////////// //////// void Manager::add() ////////// 添加车辆 { int a = 0, x, y; while(1) { if(top N) { cout 请输入需添加的车辆信息 endl; cout 车辆编号: ; cinx; for(int j = 0; j top; j++) { if ( car[j].num == x ) {  // 编号重复 cout 编号重复 ,添加失败 ! 即将跳转至功能主界面 endl; a++; break; } } if(a == 0) // 此时编号不重复 { car[top].num = x; cout  车牌号:  ; cincar[top].pnum; cout  车辆制造公司:  ; cincar[top].made; cout  购买时间:  ; cincar[top].time; cout  养路费:  ; cincar[top].RoadFee; cout 车辆型号 (1- 大客车 ,2- 小轿车 ,3- 卡车 ): ; cincar[top].type; while(!(car[top].type==1||car[top].type==2||car[top].type==3)) //  判断输入 指令是否为  1-3 { cout  输入指令号错误  ,重输:  ; cincar[top].type; } cout 总公里数:  ; cincar[top].km; if( car[top].type == 1 )  // 此时是  1- 大客车 { cout 最大载客量: ; cinpeople[top]; car[top].cost = 2000; car[top].OilKm = 0.1; } else if( car[top].type == 2 ) // 此时是 2- 小轿车 { cout 车厢数: ; cincoach[top]; car[top].cost = 1000; car[top].OilKm = 0.05; } else  // 此时是  3- 卡车 { cout 载重量: ; cinweight[top]; car[top].cost = 1500; car[top].OilKm = 0.15; } car[top].AllCount  =(OilPrice  *  car[top].OilKm

文档评论(0)

1亿VIP精品文档

相关文档