Question #262347

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 computes and displays the distance driven, in miles that the car has travelled after 0.5, 1.0, 1.5 hours, and so on until the end of the trip.


Expert's answer

#include <iostream>

using namespace std;

int main()
{
    int speed = 55;
    double time[3] = {0.5, 1.0, 1.5};
    for (int i = 0; i < 3; i++) {
        cout << "Distance: " << speed*time[i] << '\n'; 
    }

    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!

LATEST TUTORIALS
APPROVED BY CLIENTS