cout<<"Addition ="<
} void operator -(Calculator p) { Calculator q; q.a=a-p.a; cout<<"Subtraction ="<} void operator *(Calculator p) { Calculator q; q.a=a*p.a; cout<<"Multiplication ="<} void operator /(Calculator p) { Calculator q; q.a=a/p.a; cout<<"Division ="<} }; int main() { Calculator c1,c2; while(1) { c1.getdata(); c2.getdata(); int ch; cout<<"1.Addition"<cout<<"Enter your choice :"; cin>>ch; switch(ch) { case 1: c1+c2; break; case 2: c1-c2; break; case 3: c1*c2; break; case 4: c1/c2; break; case 5: return 0; default : cout<<"Incorrect choice "<} } } output:
No comments:
Post a Comment