I am working on an excersise from one of my programming books and I need to get the program to take a time in minutes and convert it to hours and minutes.
Example- The user would input a time in minutes, such as, 90 minutes.
The program will then output the time in hours and minutes, such as, 1 hour 30 minutes.
I am completely lost when it comes to this. I was able to get a program to print out the reverse but can't get it to do it like this. The closest thing I can get is a 1.5 print out.
The program I have so far is:
Code:
#include <iostream>
int hour;
int min;
int total;
int main()
{
std::cout << "How long did it take you to run the marathon in minutes? " << '\n';
std::cout << " Minute: ";
std::cin >> min;
total = min / 60;
std::cout << '\n' << total << '\n';
return(0);
}
The final print out
Code:
std::cout << '\n' << total << '\n';
was something that I just wrote in to see if I was able to get the rest of the program to print what I wanted. The program will be completed with something such as
Code:
std::cout << '\n' "Your total time took to complete the marathon in hour minute form was << total << '\n';
Thank you for your help in advance.