Hey you guys...I'm having problems trying to subtract the time you check in from the begin.set time...also how long you must wait before the end.set time...here is what I have so far that works...I'm using "Time.h"....
#include "time.h"
void Time::set(int h, int m, int s)
{
hour = h;
mins = m;
secs = s;
}
void Time::increment()
{
secs ++;
if (secs == 60)
{ mins ++;
secs = 0;
if ( mins == 60)
{ hour ++;
mins = 0;
}
if ( hour == 24)
hour = 0;
}
}
void Time::print()
{
if (hour < 10) cout << '0';
cout << hour << ":";
if (mins < 10) cout << '0';
cout << mins << ":";
if (secs < 10) cout << '0';
cout << secs << endl;
int h, m, s;
begin.set (10,0, 0);
end.set (18, 0, 0);
cout << " enter hour, min, sec\n ";
cin >>h>>m>>s;
check_in.set (h, m, s);
cout << " the time you checked in ";
check_in.print ();
if (check_in.Equal(begin))
cout << "You are right on time. Lets go to lunch !! ";
else if ( check_in.LessThan(begin))
cout << " Good Morning you are early. You have to wait ??? for lunch !! "; // Here I want to insert how long you must wait till lunch.
else if ( check_in.GreaterThan(begin))
cout << "Good Afternoon you are late. You have to wait ??? for dinner !! "; // Here I want to insert how long you have to wait till dinner.
Why do you include "time.h" twice? And what about the declaration of the class? Also, please make clear what you are trying to do. Oh, and one more thing-use[ code] and [/ code], but without the spaces.
with it,
int main( int argc, char *argv[] ) { return 0; }
becomes int main( int argc, char *argv ) { return 0; } .