using namespace std;
class calc
{public:
void inp();
};
void calc::inp()
{ int a,b;
int o;
cout<< "1 for add,2 for subtract,3 for multiply, 4 for divide";
cin>>o;
if(o==1||o==2||o==3||o==4)
{
cout< < "enter 1st no";
cin>>a;
cout< < "enter 2nd no";
cin>>b;
switch(o)
{
case 1:
cout<< "addition is"< < a+b;
break;
case 2:
if(a>b){
cout< else
cout<< b<< "-"< < a<< "is"< < b-a;
break;
case 3:
cout<< "multiplication is"<< a*b;
break;
case 4:
cout<< a<< "/"<< b<< "is"< < a/b;
break;
}}
else
cout<<"your input is wrong, choose nos 1,2,,3,4";
}
int main()
{
calc c;
char ch;
do
{
c.inp();
cout<<"\nDo another (Y/N)? ";
cin>>ch;
}while ((ch=='y')||(ch=='Y'));
}
output in user screen
ReplyDelete