Answer to Question #287788 in C++ for Meh

Question #287788

There is a parking area in a department you are required to park cars. Motor cycles and bicycles in their respective parking area. What data structure is suitable for this. Write code to park each vehicle. (Hint: All spaces are null at beginning and search empty space to park.)


1
Expert's answer
2022-01-16T09:02:48-0500
#include<iostream.h>
int main(){

int ​rs[10],hours[10],cars[10];
for(int i=1;i<=10;++i){
cout<<"Enter number car number"<<endl;
cin>>cars[i];
cout<<"Enter parking hours"<<endl;
cin>>hours[i];

if(hours[i]<=3){

rs[i]=30;
cout<<rs[i]<<endl;

}
if(hours[i]>3 && hours[i]<24){

rs[i]=30+(hours[i]-3)*5;
cout<<rs[i]<<endl;

}
if(hours[i]==24){

rs[i]=80;
cout<<rs[i]<<endl;

}

}

return ​0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment