Make a class Arithmetic. two constructer first constructer two number add and sabtruct.second constructer two number multiply and divided.
class Arithmetic
{
private:
double res;
public:
Arithmetic(double a, double b, bool add)
{
if (add)
{
res = a + b;
}
else
{
res = a - b;
}
}
Arithmetic(double a, double b, bool mlt, bool rsvd)
{
if (mlt)
{
res = a * b;
}
else
{
res = a / b;
}
}
double GetRes()
{
return res;
}
};
Comments
Leave a comment