车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx

上传人:b****8 文档编号:22499134 上传时间:2023-02-04 格式:DOCX 页数:13 大小:16.37KB
下载 相关 举报
车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx_第1页
第1页 / 共13页
车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx_第2页
第2页 / 共13页
车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx_第3页
第3页 / 共13页
车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx_第4页
第4页 / 共13页
车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx

《车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx》由会员分享,可在线阅读,更多相关《车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx(13页珍藏版)》请在冰豆网上搜索。

车辆管理系统主要负责各种车辆的常规信息管理工作Word下载.docx

usingnamespacestd;

intN=50;

/*设置全局变量N=50,信息库最多存储50辆车辆信息*/intn1=0;

/*全局变量,记录大客车文件当前信息库信息数量*/

intn2=0;

/*全局变量,记录小轿车文件当前信息库信息数量*/

intn3=0;

/*全局变量,记录卡车文件当前信息库信息数量*/ofstreamos1("

file1.dat"

ios:

:

binary|ios:

trunc);

ofstreamos2("

file2.dat"

ofstreamos3("

file3.dat"

/**********************************************************************/classcar

{/*汽车类*/

public:

stringlicense_plat;

stringcompany;

doubletime_buying;

stringmode;

voidgetcar();

voidshow(){

cout<

<

license_plat<

"

\t"

company<

\t"

time_buying<

mode<

;

}

~car(){}

};

/******************************************************************/

classtruck:

publiccar/*卡车类,公有继承汽车类*/

{

doubleload_weight;

/*卡车附加属性载重量*/

voidshow()

car:

show();

"

load_weight<

endl;

~truck(){}

classsedan:

publiccar

intCTNS;

/*小轿车附加属性箱数*/

CTNS<

~sedan(){}

/*****************************************************************/

classcoach:

intapacity;

/*大客车附加属性载客量*/

apacity<

~coach(){}

/****************************************************************/

voidcar:

getcar()/*getcar()函数实现*/

车牌号:

cin>

>

license_plat;

车辆制造公司:

company;

车辆购买时间(月):

time_buying;

车辆型号(1大客车2小轿车3卡车):

mode;

coach*getcoach()/*设置函数获取客车库中信息存储于数组中,方便之后提取*/{

inti;

coach*head=newcoach[n1];

ifstreamos1("

in|ios:

binary);

for(i=0;

i<

n1;

i++)

os1>

head[i].license_plat>

head[i].company>

head[i].time_buying

head[i].mode>

head[i].apacity;

os1.close();

returnhead;

/**********************************************************************/

sedan*getsedan()/*设置函数获取小轿车库中信息存储于数组中,方便之后提取*/

sedan*head=newsedan[n2];

ifstreamos2("

n2;

os2>

head[i].CTNS;

os2.close();

/************************************************************************/

truck*gettruck()/*设置函数获取客车库中信息存储于数组中,方便之后提取*/{

truck*head=newtruck[n3];

ifstreamos3("

n3;

os3>

head[i].load_weight;

os3.close();

/**************************************************************************/

intadd()/*添加函数*/

inti,j,k=0,x;

coachc;

sedans;

truckt;

请输入添加数量:

x;

intflag=0;

请选择添加车辆的类别(退出输入0):

*************************************************"

*1大客车2小轿车3卡车*"

j;

if(flag==0)

if(j==1)

n1++;

c.getcar();

请输入载客量:

c.apacity;

ofstreamos1("

binary|ios_base:

app);

os1<

c.license_plat<

pany<

c.time_buying<

c.mode<

c.apacity<

添加成功!

if(j==2)

n2++;

s.getcar();

请输入箱数:

s.CTNS;

os2<

s.license_plat<

s.time_buying<

s.mode<

s.CTNS<

if(j==3)

n3++;

t.getcar();

请输入载重量):

t.load_weight;

os3<

t.license_plat<

t.time_buying<

t.mode<

t.load_weight<

return0;

voidquery()/*查询函数*/

{intx,flag=0;

stringstr;

请输入查询方式(退出输入0):

****************************************"

*1车牌号查询2公司查询*"

/*按公司查询或按编号查询*/

if((x==1)||(x==2))

if(x==2)cout<

请输入公司:

elsecout<

请输入车牌号:

str;

coach*c=getcoach();

if(c[i].license_plat==str)

{cout<

车牌号制造公司购买时间型号特有属性"

c[i].show();

flag=1;

break;

if(c[i].company==str)cout<

sedan*s=getsedan();

if(s[i].license_plat==str)

s[i].show();

if(s[i].company==str)cout<

truck*t=gettruck();

if(t[i].license_plat==str)

t[i].show();

if(t[i].company==str)cout<

未找到信息,输入错误!

/*未找到符合的数据输出错误*/}

/*******************************************************************/

voidshow()/*显示函数*/

inti=0;

***************************************************"

/********************************************************************/

voidcollect()/*统计函数*/

当前车辆信息库中共有"

n1+n2+n3<

条车辆信息."

其中:

n1<

条大客车信息,"

endl<

n2

条小轿车信息"

n3<

条卡车信息."

intmain()

inta;

***********************************************************"

\t"

**欢迎进入车辆管理系统**"

***********************************************"

*车辆管理系统:

*"

*1添加*"

*2查询*"

*3显示*"

*4统计*"

*5退出*"

*请选择:

a;

/*输入选项*/

do{

switch(a){

case1:

add();

case2:

query();

case3:

case4:

collect();

case5:

\n\n\t\t\t欢迎再次使用汽车库管理系统\n\n"

exit

(1);

default:

ERROR:

输入选项错误!

/*完成操作后给用户再次提供选项界面*/

}while

(1);

 

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 高考

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1