CHALLENGE ACTIVITY 7.3.1: Functions: Factoring out a unit-conversion calculation. Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original main(): int main() { double milesPerHour; double minutesTraveled; double hoursTraveled; double milesTraveled; cin >> milesPerHour; cin >> minutesTraveled; hoursTraveled

Respuesta :

Answer:

See Explaination

Explanation:

#include <stdio.h>

MphAndMinutesToMiles()

{

double milesPerHour;

double minutesTraveled;

double hoursTraveled;

double milesTraveled;

scanf("%lf", &milesPerHour);

scanf("%lf", &minutesTraveled);

hoursTraveled = minutesTraveled / 60.0;

milesTraveled = hoursTraveled * milesPerHour;

printf("Miles: %lf\n", milesTraveled);

}

int main()

{

MphAndMinutesToMiles();

return 0;

}