Challenge: Perform the Calculation

Let’s create a calculator using variadic arguments.

We'll cover the following

Problem statement

Assume that the following enum is already defined:

enum Operation { add, subtract, multiply, divide }

Also, assume that there is a struct that represents the calculation of an operation and its two operands:

struct Calculation {
    Operation op;
    double first;
    double second;
}
svg viewer

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy