Calculate my degree

Report a typo

You have a basic Calc class:

class Calc {
public:
    double a;
    double b;


    double addition() {
        return a + b;
    }

    double multiplication() {
        return a * b;
    }

    double division() {
        if (b != 0)
            return a / b;
        else
            std::cout << "Division by zero is not allowed." << std::endl;
    }

    double subtraction() {
       return a - b;
    }
};

You need to implement a descendant class called ExtCalc. This class should have an additional method: exponentiation. The essence of this method is that it raises the first number to the power of the second.

Sample Input 1:

1 1

Sample Output 1:

2
1
1
0
1
Write a program in C++





Create a free account to access the full topic