I am working on a programming assignment. I have everything for it done except the following:
I am trying to use the setfill function to display the time it takes to complete a task in the format H:MM, in which will fill in a '0:xx' for times less than 60 minutes, and a '0:0x' for times less than 10 minutes. I know I have to use the modulus operator at some point but I am looking for some guidance.
#include <iostream>
#include <iomanip>
usingnamespace std;
int main ( ) {
for ( int h = 0 ; h < 60 ; h += 5 ) {
for ( int m = 0 ; m < 60 ; m += 5 ) {
cout << setfill('0') << setw(2) << h
<< ":"
<< setfill('0') << setw(2) << m << endl;
}
}
}
enter the amount of time in minutes it takes to do english: 6
enter the amount of time in minutes it takes to do math: 42
enter the amount of time in minutes it takes to do science: 90
i want it to display the times as 0:06, 0:42, and 1:30 respectively
our class hasn't gone over for loops yet so i assume the assignment doesn't require it.