Quickpaste.it
Create Paste
Top Pastes
Recent Pastes
Settings
Account
Untitled Paste
Created By
Anonymous
Expires never
Raw
Download
0
#include <iostream.h> #include <conio.h> #include <iomanip.h> class time { int h,m,s; public: void read() { cout<<"enter the h,m and s\n"; cin>>h>>m>>s; } void print() { cout<<setfill('0')<<setw(2)<<h<<";"<<setfill('0')<<setw(2)<<m<<";"<<setfill('0')<<setw(2)<<s<<";"<<"\n"; } void add(time t) { h=h+t.h; m=m+t.m; s=s+t.s; } void sub(time t) { h=h-t.h; m=m-t.m; s=s-t.s; } void convert() { s=h*3600+m*60+s; cout<<"total seconds:"<<s; } }; void main() { clrscr(); time t1,t2,t3; t1.read(); t1.print(); t2.read(); t2.print(); t3.read(); t3.print(); t1.add(t2); t1.print(); t2.sub(t3); t2.print(); t1.convert(); getch(); }