By using this site, you agree to our Privacy Policy and our Terms of Use. Close

General - c++ question - View Post

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!



Gesta Non Verba

Nocturnal is helping companies get cheaper game ratings in Australia:

Game Assessment website

Wii code: 2263 4706 2910 1099