daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Oct 27th, 2010 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream.h>
  2. #include<conio.h>
  3. class time
  4. {
  5.       int hours ;
  6.       int minutes ;
  7.      
  8.       public:
  9.              void gettime();
  10.              void puttime();
  11.              {
  12.                   cout<<hours<<"hours and \n";
  13.                   cout<<minutes<<"minutes \n";
  14.                   }
  15.                  
  16.                   void sum(time,time);
  17.                   }
  18.                   ;
  19.                  
  20.                   void time::sum(time t1, time t2)
  21.                   {
  22.                        minutes=t1.minutes+t2.minutes;
  23.                        hours=minutes/60;
  24.                        minutes=minutes%60;
  25.                        
  26.                        hours = hours + t1.hours+t2.hours;
  27.                        }
  28.                        
  29.                        void time::getttime()
  30.                        {
  31.                             cout<<"enter the time in hour and minute";
  32.                             cin>>hours>>minutes;
  33.                            
  34.                             }
  35.                            
  36.                             void main ()
  37.                             {
  38.                                  clrscr();
  39.                                  
  40.                                  time t1,t2,t3;
  41.                                  t1.gettime();
  42.                                  t2.gettime();
  43.                                  t3.sum(t1,t2);
  44.                                  
  45.                                  clrscr();
  46.                                  
  47.                                  cout<<"t1=" ;t1.puttime();
  48.                                  cout<<"t2=" ; t2.puttime();
  49.                                  cout<<"the total time is : ";
  50.                                  
  51.                                  cout<<"t3 = "; t3.puttime();
  52.                                  getch();
  53.                                  }
RAW Paste Data
Top