Wednesday, 23 October 2013

C class implementation help

Posted by Саша 11:04, under | No comments


C++ class implementation help? C++ class implementation help?

Hello everyone! I'm writing a program that checks if a current time is equal to time to seconds (easier shown in my example output posted below)

and I'm having trouble figuring out a few functions, I've got most and most of these should be farily simple but I haven't been able to get them to work.

These are the two functions I'm struggling with:


Time::isAM() const
{
// Function isAM - returns true if the time is ante meridiem; that
// is, before noon. By definition, 12:00:00 A.M. denotes midnight
// (that is, hour, minute, and second are all zero), and 12:00:00 P.M.
// denotes noon (that is, hour equals 12 and minute and second
// are both zero).
}


Time::setTime(int, int, int)
{
// Function setTime - set hour, minute, second
// if hr is in the range [0..23] then assign hr to hour;
// otherwise, assign 0 to hour
// if min is in the range [0..59] then assign min to minute;
// otherwise, assign 0 to minute
// if sec is in the range [0..59] then assign sec to second;
// otherwise, assign 0 to second
}




My full code including class:
http://ideone.com/weVegR

more simple version of current code thanks to Andrejs:
https://docs.google.com/file/d/0B1qDMmxZfmLma2tLcGVabi0wREE/edit?usp=sharing


example output:

0 коммент.:

Post a Comment