Hi, my homework problem is to convert minutes into hours AND minutes
ex.
124 minutes = 2 hour(s) and 4 minute(s) (there will be some if statements for plurals of hours and minutes if possible)
This is my code so far but I'm getting an error
#include <iostream>
using namespace std;
int Convert(int);
int remainder;
int main ()
{
int minutes;
int convert_to_hours;
int remainder;
cout << "This program converts minutes to hours and minutes. " << endl;
cout << "Please enter a number of minutes (an integer) to be converted:" << endl;
cin >> minutes;
convert_to_hours = Convert(minutes);
if (convert_to_hours > 1)
cout << minutes << " mintes equal to " << convert_to_hours << " hours ";
else
cout << minutes << " mintes equal to " << convert_to_hours << " hour ";
if (remainder > 1)
cout << "and " << remainder << "minutes." << endl;
else
cout << "and " << remainder << "minute." << endl;
return 0;
}
int Convert(int minutes)
{
int convert_to_hours;
convert_to_hours = minutes / 60;
return convert_to_hours;
}
int Convert(int remainder)
{
int remainder;
remainder = minutes % 60;
return remainder;
}
Thank you so much if anyone can help, I'm stuck on this for 7 hours.