In below program both if statements gives an error #include<iostream> #include<conio.h> using namespace std; class operation { int bank_id,balance; public: int input() { cout<<"enter the bank_id "; cin>>bank_id; cout<<"enter the balance "; cin>>balance; } operation operator ==(operation p) { operation b1,b2; b1.bank_id=bank_id+p.bank_id; b1.balance=balance+p.balance; b2.bank_id=bank_id+p.bank_id; b2.balance=balance+p.balance; if(b1==b2) { return b1; } else { return b2; } } operation operator++() { operation d1; d1.bank_id=bank_id+10; d1.balance=balance; return d1; } operation operator--() { operation d2; d2.bank_id=bank_id; d2.balance=balance-10; return d2; } int display() { cout<<"the bank_id is ::"<<bank_id; cout<<"the balance is ::"<<balance; } }; int main() { operation ban1,ban2,res1,res2; ban1.input(); ban2.input(); if(ban1==ban2) { res1=++ban1; res1.display(); } else { res2=--ban2; res2.display(); } }
Shoaib_6 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.