Answer to Question #279494 in C++ for Alunsina

Question #279494

An automobile travels at an average speed of 55 miles per hour for four hours. Draw a flowchart, write an algorithm and design a C++ program that displays the distance driven, in miles that the car has traveled after 0.5 1.0, 1.5 hours, and so on until the end of the trip.


1
Expert's answer
2021-12-14T07:02:56-0500

The program:

#include<iostream>
using namespace std;
int main(){
double speed = 55;


double hours = 4;


double distance = 0;


double i = 0.5;
while(i<=hours){
	distance = distance + (speed / 2);
	cout<<i<<endl;
	cout<<"Distance:Β  "<<distance<<endl;
	i += 0.5;
	
}


}




The Flowchart:

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

LATEST TUTORIALS
New on Blog