#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
您可能关注的文档
最近下载
- Ф90橡胶冷喂料挤出机毕业设计说明书.docx VIP
- 《行测》《行测》题库型介绍(基础题).docx VIP
- 北师大五年级下册全册数学教案.docx VIP
- 石蜡制备高碳醇工艺条件研究.pdf VIP
- 2025届宁夏回族自治区吴忠市盐池县高三下学期第一次模拟考试物理试卷.pdf VIP
- 浙江省中小学正高级教师职称评审表2017.pdf VIP
- 80辛集互联网搜索引擎在成功抓获漂白身份潜逃十二年绑架逃犯中的具体应用3542.pdf VIP
- 《故宫IP联名文创产品开发与销售总结》_国潮文创产品经理.docx
- 人教版(2019)必修第一册 Unit 3 Sports and Fitness Reading and thinking Living Legends 教学设计.pdf VIP
- 专题01+完形填空之综合解题技巧(复习课件)(全国通用)2026年高考英语二轮复习讲练测.pptx VIP
原创力文档

文档评论(0)