Miles to track laps One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 1.5 the output is: 6.00 Ex: If the input is: 2.2 the output is: 8.80 Your program must define and call a function: double MilesToLaps(double userMiles)

Respuesta :

Answer:

Explanation:

#include <iostream>

using namespace std;

//This is the function in the next line

double MilesToLaps(double userMiles) {

double Laps;  

Laps = userMiles * 4;

return Laps

}

//This is the main fucnction

int main(){

double Miles, FinLap;

cout << "Enter the number of miles " << endl;

cin>>Miles;

FinLap = MilesToLaps(Miles);

cout << "The number of laps ran is: "<<setprecision(2)<<Finlap<<endI;

}

Answer:

def miles_to_laps(user_miles):

return user_miles/0.25

if __name__ == '__main__':

miles = float(input(""))

lap = miles_to_laps(miles)

print("%.2f"%lap)

Explanation: