Write a C++ program using class to
overload the operator Binary for an integer number.
#include<iostream.h>
#include<conio.h>
int
add(int,int); //declaration prototype
int
sub(int,int);
int
mult(int,int);
class
Binary
{
public:
int
add(int a,int b)
{
return(a+b);
}
int
sub(int a, int b)
{
return
a-b;
}
int
mult(int a, int b)
{
return
a*b;
}
int
div(int a, int b)
{
return
a/b;
}
};
void
main()
{
clrscr();
int x,y,z;
Binary b;
cout<<"\n Please input a number-:";
cin>>x;
cout<<"\n Please input another number-:";
cin>>y;
cout<<"\n
The Addition of " << x << "and" <<y
<<"is -:" << b.add(x,y);
cout<<"\n
The Subtraction of"<< x << "and" <<y
<<"is :-"<<b.sub(x,y);
cout<<"\n
The Multiplication of"<< x
<< "and" <<y <<"is
:-"<<b.mult(x,y);
cout<<"\n
The Multiplication of"<< x
<< "and" <<y <<"is :-"<<b.div(x,y);
getch();
}