Answer to Question #262347 in C++ for Alunsina

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.


1
Expert's answer
2021-11-10T09:36:46-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS