Answer to Question #186283 in C++ for zain ul abdeen

Question #186283

Make a class Arithmetic. two constructer first constructer two number add and sabtruct.second constructer two number multiply and divided.


1
Expert's answer
2021-04-29T19:13:31-0400
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;
    }
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS