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.

Error #1- You didn't use CODE Tags
Error #2- You didn't bother to tell us what the error you're talking about is. This isn't the Psychic Homework Help Desk.

you have 2 functions that are named the same and take the same argument.

## All 5 Replies

Error #1- You didn't use CODE Tags
Error #2- You didn't bother to tell us what the error you're talking about is. This isn't the Psychic Homework Help Desk.

you have 2 functions that are named the same and take the same argument.

I'm sorry I thought you would use my code to see the error for yourself first hand.

Error is that Convert(int) already has a body.
I think it's because I'm trying to give it 2 commands (for finding hours and finding remainder).

I've tried to do Convert(int convert_to_hours, int remainder) to give it another body but it just leads to more errors.

I'm sorry I thought you would use my code to see the error for yourself first hand.

Why?
it's so much faster for you to tell us than for us to create a project, add your code, and compile. And I for one have many other posts to look at.

Error is that Convert(int) already has a body.
I think it's because I'm trying to give it 2 commands (for finding hours and finding remainder).

Yes. What does `Convert()` do? Why not give the functions names that makes sense? Neither `Convert()` function really converts.

Why?
it's so much faster for you to tell us than for us to create a project, add your code, and compile. And I for one have many other posts to look at.

Yes. What does `Convert()` do? Why not give the functions names that makes sense? Neither `Convert()` function really converts.

Ah thanks, that actually fixed my problem 100%.

And sorry about the trouble, I'm just trying what I think is easiest for us all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.