c icon indicating copy to clipboard operation
c copied to clipboard

Getting compilation error in this c++ program #include <iostream> using namespace std; class Time {     int h, m, s; public:     Time()     {         h = 0, m = 0, s = 0;     }     void setTime();     void show()     {         cout << h << ":" << m << ":" << s;     }     Time operator+(Time); }; Time Time::operator+(Time t1) {     Time t;     int a, b;     a = s + t1.s;     t.s = a % 60;     b = (a / 60) + m + t1.m;     t.m = b % 60;     t.h = (b / 60) + h + t1.h;     t.h = t.h % 12;     return t1; } int main() {     Time t1, t2, t3;     cout << "enter the first time";     t1.setTime();     cout << "\n Enter the second time";     t2.setTime();     t3 = t1 + t2;     cout << "\n first time";     t1.show();     cout << "\nsecond time";     t2.show();     cout << "\n sum of times";     t3.show();     return 0;     }

Open Diliphindustani opened this issue 8 months ago • 1 comments

Diliphindustani avatar Oct 20 '23 10:10 Diliphindustani