Hey, i'm just learning c++ and a program i wrote awhile ago i am going back to fix and am having problems.
Specs: obtain minutes from user then output as hours:minutes
example: input 327 from user output 5:27
problem i'm having is if they input 302 etc. i get 5:2 rather than 5:02 or if they put 300 minutes it comes out with 5:0
My book says it's possible and says (hint: Use the modulus operator)
what i have:
===========================
Code:
#include <iostream.h>
int main ()
{
int minutes;
cout << endl;
cout << endl;
cout << "\tEnter the number of minutes: ";
cin >> minutes;
cout << "\tThis is " << (minutes/60) << ":" << (minutes%60);
cout << endl;
cout << endl;
cout << endl;
cout << "\t";
return (0);
}