1停车场系统代码.docx

上传人:b****6 文档编号:7513095 上传时间:2023-01-24 格式:DOCX 页数:22 大小:17.98KB
下载 相关 举报
1停车场系统代码.docx_第1页
第1页 / 共22页
1停车场系统代码.docx_第2页
第2页 / 共22页
1停车场系统代码.docx_第3页
第3页 / 共22页
1停车场系统代码.docx_第4页
第4页 / 共22页
1停车场系统代码.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

1停车场系统代码.docx

《1停车场系统代码.docx》由会员分享,可在线阅读,更多相关《1停车场系统代码.docx(22页珍藏版)》请在冰豆网上搜索。

1停车场系统代码.docx

1停车场系统代码

#include

#include

#include

#defineMaxChe3

#defineChefei0.5

usingnamespacestd。

classTime

{

public:

intyear。

intmouth。

intday。

inthour。

intminute。

intsecond。

voidsetTime(>

{

cout<<"Time"<

cout<<"year:

"。

cin>>year。

cout<<"mouth:

"。

cin>>mouth。

cout<<"day:

"。

cin>>day。

cout<<"hour:

"。

cin>>hour。

cout<<"minute:

"。

cin>>minute。

cout<<"second:

"。

cin>>second。

}

voidshowTime(>

{

cout<

}

}。

classChe{

public:

stringID。

stringColor。

stringCheXing。

TimeaTime。

Che*Next。

Che(>{}

voidSet(>

{

cout<<"ID="。

cin>>ID。

cout<<"Color="。

cin>>Color。

cout<<"CheXing=(xiaoqichexiaokazhongkadaka>"<

cin>>CheXing。

aTime.setTime(>。

}

voidshow(>

{

cout<

cout<

cout<

aTime.showTime(>。

}

~Che(>{}

}。

voidShouye(>。

//首页

voidInput(>。

//车辆进入停车场

voidOutput(>。

//车辆离开停车场并计算停车费用

voidChaxun(>。

//按车牌查询停车信息

voidXianshi(>。

//显示车库中的车辆信息

voidTongji(>。

//统计车库中的车

voidBianji(>。

//修改车库中的车的信息

voidCuo1(>。

//

voidmain(>

{

Shouye(>。

}

voidShouye(>//首页

{

inti。

cout<<"**************************\n"。

cout<<"\t"<<"1.汽车进停车场\n"。

cout<<"\t"<<"2.汽车出停车场\n"。

cout<<"\t"<<"3.汽车信息查询\n"。

cout<<"\t"<<"4.显示所有汽车\n"。

cout<<"\t"<<"5.汽车信息统计\n"。

cout<<"\t"<<"选择操作:

"。

cin>>i。

switch(i>

{

case1:

{

system("cls">。

Input(>。

break。

}

break。

case2:

{

system("cls">。

Output(>。

break。

}

break。

case3:

{

system("cls">。

Chaxun(>。

break。

}

break。

case4:

{

system("cls">。

Xianshi(>。

break。

}

break。

case5:

{

system("cls">。

Tongji(>。

break。

}

break。

default:

{

cout<<"无此选项!

"<

cout<<"1.返回首页从新选择"<

stringh。

cin.clear(>。

cin>>h。

if(h=="1">

{

system("cls">。

Shouye(>。

}

else{

Cuo1(>。

}

}

}

}

voidInput(>//车辆进入停车场

{

ifstreamfin("text.txt",ios:

:

in>。

if(!

fin>

{

cout<<"文件打开失败!

"<

}

inti。

fin>>i。

cout<<"停车场中已有车"<

Chep[MaxChe]。

for(intj=0。

j

j++>

{

fin>>p[j].ID>>p[j].Color>>p[j].CheXing>>p[j].aTime.year>>p[j].aTime.mouth

>>p[j].aTime.day>>p[j].aTime.hour>>p[j].aTime.minute>>p[j].aTime.second。

cout<

<

"<

"<

}

fin.close(>。

if(i

{

cout<<"车辆可以进入停车场"<

p[i].Set(>。

ofstreamfout("text.txt",ios:

:

out>。

fout<

for(intj=0。

j

j++>

{

fout<

<<"\t"<

}

fout.close(>。

cout<<"***************************************************"<

cout<<"1.继续停车"<

cout<<"2.返回首页"<

inth。

cin>>h。

if(h==1>

Input(>。

if(h==2>

{

system("cls">。

Shouye(>。

}

if(h!

=1&&h!

=2>

Cuo1(>。

}

else

{

cout<<"****************************************************"。

cout<<"停车场已满!

"<

cout<<"1.返回首页"<

inth。

cin>>h。

if(h==1>

{

system("cls">。

Shouye(>。

}

else

Cuo1(>。

}

}

voidOutput(>//车辆离开停车场并计算停车费用

{

ifstreamfin("text.txt",ios:

:

in>。

if(!

fin>

{

cout<<"文件打开失败!

"<

}

inti。

fin>>i。

cout<<"停车场中已有车"<

Chep[MaxChe]。

for(intj=0。

j

j++>

{

fin>>p[j].ID>>p[j].Color>>p[j].CheXing>>p[j].aTime.year>>p[j].aTime.mouth

>>p[j].aTime.day>>p[j].aTime.hour>>p[j].aTime.minute>>p[j].aTime.second。

cout<

<

"<

"<

}

fin.close(>。

if(i!

=0>

{

stringcp。

cout<<"按车牌查询"<

cout<<"离开停车场车牌:

"。

cin>>cp。

cout<<"出场时间"<

TimebTime。

bTime.setTime(>。

ofstreamfout("text.txt",ios:

:

out>。

fout<

for(j=0。

j

j++>

{

if(p[j].ID==cp>

{

cout<<"*************************************************************"<

cout<<"该车进入停车场时间为:

"。

cout<

<

"<

"<

cout<<"每分钟"<

intmoney。

money=(bTime.year-p[j].aTime.year>*12*31*24*60+(bTime.mouth-p[j].aTime.mouth>*31*24*60+(bTime.day-p[j].aTime.day>*24*60+(bTime.hour-p[j].aTime.hour>*60+(bTime.minute-p[j].aTime.minute>*10。

cout<<"共计:

"<

}

}

for(j=0。

j

j++>

{

if(p[j].ID==cp>

{

inta。

a=j。

for(j=0。

j

j++>

{

fout<

<

}

for(intj=a+1。

j

j++>

{

fout<

<

}

cout<<"离场成功*******************"<

cout<<"1.返回首页"。

inth。

cin>>h。

if(h==1>

{

system("cls">。

Shouye(>。

}

else

Cuo1(>。

break。

}

}

fout.close(>。

}

else

{

cout<<"停车场中无车"<

cout<<"1.车辆进入停车场"<

cout<<"2.返回首页"<

inth。

cin>>h。

if(h==1>

Input(>。

if(h==2>

{

system("cls">。

Shouye(>。

}

if(h!

=1&&h!

=2>

Cuo1(>。

}

}

voidChaxun(>//按车牌查询停车信息

{

ifstreamfin("text.txt",ios:

:

in>。

if(!

fin>

{

cout<<"文件打开失败!

"<

}

inti。

fin>>i。

cout<<"停车场中已有车"<

Chep[MaxChe]。

for(intj=0。

j

j++>

{

fin>>p[j].ID>>p[j].Color>>p[j].CheXing>>p[j].aTime.year>>p[j].aTime.mouth

>>p[j].aTime.day>>p[j].aTime.hour>>p[j].aTime.minute>>p[j].aTime.second。

cout<

<

"<

"<

}

fin.close(>。

if(i!

=0>

{

stringcx。

cout<<"按车牌查询"<

cout<<"车牌号:

"。

cin>>cx。

for(j=0。

j

j++>

{

if(p[j].ID==cx>

{

cout<<"*************************************************************"<

cout<

<

"<

"<

cout<<"*****"<

cout<<"1.删除该车信息"<

cout<<"2.修改该车信息"<

cout<<"3.返回首页"<

inth。

cin>>h。

if(h==1>

{

ofstreamfout("text.txt",ios:

:

out>。

inta。

a=j。

fout<

for(j=0。

j

j++>

{

fout<

<

}

for(intj=a+1。

j

j++>

{

fout<

<

}

fout.close(>。

cout<<"删除成功!

"<

cout<<"1.返回首页"<

into。

cin>>o。

if(o==1>

{

system("cls">。

Shouye(>。

}

else

Cuo1(>。

}

if(h==2>

{

cout<<"******************************"<

cout<<"1.修改单种信息"<

cout<<"2.修改多种信息"<

inth。

cin>>h。

if(h==1>

{

cout<<"******************************"<

cout<<"1.修改车牌"<

cout<<"2.修改车色"<

cout<<"3.修改车型"<

cout<<"4.修改车辆入场时间"<

into。

cin>>o。

if(o==1>

{

cout<<"ID:

"。

cin>>p[j].ID。

}

if(o==2>

{

cout<<"Color"。

cin>>p[j].Color。

}

if(o==3>

{

cout<<"CheXing"。

cin>>p[j].CheXing。

}

if(o==4>

{

cout<<"year"。

cin>>p[j].aTime.year。

cout<<"mouth"。

cin>>p[j].aTime.mouth。

cout<<"day"。

cin>>p[j].aTime.day。

cout<<"hour"。

cin>>p[j].aTime.hour。

cout<<"minute"。

cin>>p[j].aTime.minute。

cout<<"second"。

cin>>p[j].aTime.second。

}

if(o!

=1&&o!

=2&&o!

=3&&o!

=4>

Cuo1(>。

break。

}

if(h==2>

{

cout<<"ID:

"。

cin>>p[j].ID。

cout<<"Color"。

cin>>p[j].Color。

cout<<"CheXing"。

cin>>p[j].CheXing。

cout<<"year"。

cin>>p[j].aTime.year。

cout<<"mouth"。

cin>>p[j].aTime.mouth。

cout<<"day"。

cin>>p[j].aTime.day。

cout<<"hour"。

cin>>p[j].aTime.hour。

cout<<"minute"。

cin>>p[j].aTime.minute。

cout<<"second"。

cin>>p[j].aTime.second。

}

if(h!

=1&&h!

=2&&h!

=3>

Cuo1(>。

ofstreamfout("text.txt",ios:

:

out>。

inta。

a=j。

fout<

for(j=0。

j

j++>

{

fout<

<

}

fout.close(>。

}

if(h==3>

{

system("cls">。

Shouye(>。

}

if(h!

=1&&h!

=2&&h!

=3>

Cuo1(>。

break。

}

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

当前位置:首页 > 求职职场 > 简历

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

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