setfill function

hello:

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.
Create a little side project to test ideas.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <iomanip>

using namespace 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;
    }
  }
}
so for each task, the user put in information:

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.
That should work just fine then.
Topic archived. No new replies allowed.