#include<iostream.h> class time { int m; int h; public: void set(int,int); void sum(time,time,time); void display(); }; void time::set(int x,int y) { m=x; h=y; } void time::sum(time t1,time t2,time t3) { m=t1.m+t2.m+t3.m; h=t1.h+t2.h+t3.h; } void time::display(void) { cout<<"minute=="<<m<<endl; cout<<"hours=="<<h<<endl; } int main() { time a,b,c,d; a.set(1,2); b.set(2,4); c.set(4,8); d.sum(a,b,c); //display a.display(); b.display(); c.display(); d.display(); return 0; }
dis does works...chk it out!!! Regards, PAYAL GUPTA, CSE-3rd yr, NIT_B On Thu, Sep 22, 2011 at 9:28 PM, Don <dondod...@gmail.com> wrote: > Give us some help. What is the error? Syntax error? Logic error? > Runtime error? > > On Sep 22, 10:47 am, Rajesh Kumar <testalgori...@gmail.com> wrote: > > how we can remove error ? > > #include<iostream> > > using namespace std; > > class time > > { > > int m; > > int h; > > public: > > void set(int,int); > > void sum(time,time,time); > > void display();}; > > > > void time::set(int x,int y) > > { > > m=x; > > h=y;} > > > > void time::sum(time t1,time t2,time t3) > > { > > m=t1.m+t2.m+t3.m; > > h=t1.h+t2.h+t3.h;} > > > > void time::display(void) > > { > > cout<<"minute=="<<m<<endl; > > cout<<"hours=="<<h<<endl;} > > > > int main() > > { > > time a,b,c,d; > > a.set(1,2); > > b.set(2,4); > > c.set(4,8); > > d.sum(a,b,c); > > //display > > a.display(); > > b.display(); > > c.display(); > > d.display(); > > > > } > > > > Regards > > Rajesh Kumar > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.