13. Many treadmills output the speed of the treadmill in miles per hour (mph) on the console, but most runners think of speed in terms of a pace. A common pace is the number of minutes and seconds per mile instead of mph.
Write a program that starts with a quantity in mph and converts the quantity into minutes and seconds per mile. As an example, the proper output for an input of 6.5 mph should be 9 minutes and 13.8 seconds per mile. (Continued)
//Header file section
#include<iostream>
using namespace std;
int main()
{
double mph;
cout<<"Enter the speed of the treadmill in mph:";
cin>>mph;
double min_per_mile=(1/mph)*60;
int min=static_cast<int>(min_per_mile);
double sec=(min_per_mile-min)*60;
cout<<"A common pace is the "<<min<<" minutes and "<<sec
<<" seconds per mile"<<endl;
return 0;
}
OUTPUT OF THE PROGRAM CODE:
Enter the speed of the treadmill in mph:6.5
A common pace is the 9 minutes and 13.8462 seconds per mile