Hi all,
Ok, I've just been trying to write a program that will convert MPH (miles per hour) into the number of minutes and seconds it takes that person to run one mile. This is what I have:
#include <iostream>
using namespace std;
int main()
{
double mph, count = 1;
int mpm, seconds;
cout << "\n";
cout << "Program that converts MPH into minutes and seconds per mile." << endl;
cout << "Please enter the MPH at which you were running: ";
cin >> mph;
cout << endl;
mpm = mph / 60;
do{
mpm = mpm * 2;
count = count + 1;
}
while (mpm < 1);
seconds = mpm % 60;
cout << "You are running 1 mile in " << count << " minutes and " << seconds << " seconds.";
cout << endl;
return 0;
}
The compiler doesnt like the '%' in my code. Is that because it has to be an integer value to follow it? Also not too sure if i've opted for the simplest method to solve the problem.
Thanks in advance!