By using this site, you agree to our Privacy Policy and our Terms of Use. Close
shams said:
Meh :)

I won't do the whole thing here/now, but it seems pretty trivial. The key (IMO) is representing time in seconds ONLY (i.e. as a single int) - and then it becomes pretty easy.

i.e.

bool operator == (const Time & rhs)
{
return m_seconds == rhs.m_seconds;
}

Time operator + (const Time & rhs)

{
Time t;

t.Set(m_seconds + rhs.m_seconds); // or use another constructor...
return t;
}

int m_seconds;
...

The only tricky bit is parsing the input into seconds - and even that's pretty easy. Break down input string into three ints - then:

m_second = (hours * 3600) + (minutes * 60) + seconds;

...something like that anyway!

the operator+ takes 2 arguments, say lhs and rhs. unless you make it as a member function, but you didn't do that here :)

yeah, you can have a "total_seconds" variable in your class... or just make the comparisons on the fly. since this is an assignment just pick the one you're more comfortable with.

good luck!

edit: same comment with operator==



the Wii is an epidemic.