9.2. printTimeΒΆ

When we define a new type it is a good idea to write function that displays the instance variables in a human-readable form, which you attempted on the page before. Your solution should have looked something like this.

void printTime (Time& t) {
  cout << t.hour << ":" << t.minute << ":" << t.second << endl;

In the active code below, the output of this function, if we pass time an argument, is 11:59:3.14159.

You have attempted of activities on this page