- #include<iostream.h>
- #include<conio.h>
- class time
- {
- int hours ;
- int minutes ;
- public:
- void gettime();
- void puttime();
- {
- cout<<hours<<"hours and \n";
- cout<<minutes<<"minutes \n";
- }
- void sum(time,time);
- }
- ;
- void time::sum(time t1, time t2)
- {
- minutes=t1.minutes+t2.minutes;
- hours=minutes/60;
- minutes=minutes%60;
- hours = hours + t1.hours+t2.hours;
- }
- void time::getttime()
- {
- cout<<"enter the time in hour and minute";
- cin>>hours>>minutes;
- }
- void main ()
- {
- clrscr();
- time t1,t2,t3;
- t1.gettime();
- t2.gettime();
- t3.sum(t1,t2);
- clrscr();
- cout<<"t1=" ;t1.puttime();
- cout<<"t2=" ; t2.puttime();
- cout<<"the total time is : ";
- cout<<"t3 = "; t3.puttime();
- getch();
- }
SHARE
TWEET
Untitled
a guest
Oct 27th, 2010
22
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
