i'm trying to design, implement and test a class that rep. an amount of time in minutes %26amp; seconds. A constructor must be used in the class that sets the time to a spec. number of min. %26amp; secs. The default constructor should create an object for a time of zero minutes %26amp; zero seconds and provide observeres that return the minutes and seconds separately and observer that returns the total time in minutes X 60 + seconds. Transformers should be provided that add one time to another and that subtract one time from another - no negative time allowed.
I've started some of the coding on this already, but really need some help. I'm brand new to programming .My next post will be what I've coded so far.
C++ Programming problem-time class?
here:
class time
{
int t;
public:
time() : t(0) {}
time(int x) : t(x) {}
time(int m, int s) : t(m*60+s) {}
int m() {return t/60;}
int s() {return t%60;}
operator int () {return t;}
};
Reply:http://www.techtutorials.net/Programming...
survey monkey
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment