// Arithmatic operation on class #include<iostream> #include<stdlib.h> #include<stdio.h> using namespace std; class abc{ int a,b,c; public: void set() { cout<<"\nEnter a number :";cin>>b; cout<<"Enter a second number :";cin>>c; cout<<endl<<endl; } void get(int a){ int f=a; if(f==1){ set(); cout<<"\nddition of two number is :"<<b+c<<endl; } if(f==2){ set(); cout<<"\nminus of two number is :"<<b-c<<endl; } if(f==3){ set(); cout<<"\nmultiply of two number is :"<<b*c<<endl; } if(f==4){ set(); cout<<"\ndivision of two number is:"<<b/c; } } }; int main(){ abc st; system("clear"); int x,a; x: cout<<"1.addition"<<endl; cout<<"2.minus"<<endl; cout<<"3.multiply"<<endl; cout<<"4.divion"<<endl; cout<<"Enter your choice :"; cin>>a; st.get(a); cout<<"\n\nagain tap 1"; int ag; cin>>ag; if(ag=1){ system("clear"); goto x; } }
1.addition 2.minus 3.multiply 4.divion Enter your choice : 1 Enter a number : 10 Enter a second number :20 Addition of two number is : 30
0 Comments