#include <iostream.h>
#include <conio.h>
class time
{
int hour;
int min;
public :
void GetTime ();
time AddTime(time t1);
void ShowTime();
};
void GetTime()
{ cin<< hour;
cin<< min;
}
void ShowTime()
{
cout<< “ Hours=“<< hour;
cout<<“Minutes=“<< min;
}
time AddTime(time t1 )
{ time t3;
t3.hour = t1.hour +hour;
t3.min = t1.min + min;
if (t3.hour>=60)
h1= t3.hour – 60;
t3.min= t3.min + h1;
}
}
void main()
{
time x1, x2, x3;
x1.GetTime();
x2.GetTime();
x3= x2.AddTime(x1);
x1.ShowTime();
x2.ShowTime();
x3.ShowTime();
}
No comments:
Post a Comment