this program accept the following:
1. 5 type of car (a,b,c,d,f)
2.for each it accept the length of the car in centimeter
3.the length of the road in kilometer
4.the number of the lanes in the road
5.if the road is double-side or not
the program then calculates that how many of cars can fit on the road. the program assume 2 meters distance between each tow consecutive cars. the program also assume that there would be exactly 20% of each ace type on the road
1
Expert's answer
2012-11-20T08:10:46-0500
# include <iostream>
using namespace std;
int main(){ int car[5]; double road; int num; bool size; char c; for(int i=0;i<5;i++){ cout<<"Enter size of car "<<i<<endl; cin>>car[i];}
cout<<"Enter km of road"<<endl; cin>>road; cout<<"Enter num of lanes "<<endl; cin>>num; cout<<"Road is double-sized? (y/n) "<<endl; cin>>c; if ((c=='y')||(c=='Y')) {size=1; num*=2;} else size=0;
int am=static_cast <int> (num*road*1000/(((2+car[0])+(2+car[1])+(2+car[2])+(2+car[3])+(2+car[4])))); & cout<<"MAX amount of each car is "<<am<<endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment