| 14 | ***********************************************************/ |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | // Create the even operands as Integers, |
| 19 | // and use implicit conversions from int for the odd values |
| 20 | const Integer four{4}; |
| 21 | const Integer six{6}; |
| 22 | const Integer eight{8}; |
| 23 | |
| 24 | // We can calculate 4*5*5*5+6*5*5+7*5+8 as: |
| 25 | // ((4*5+6)*5+7)*5+8 |
| 26 | Integer result {four}; // Set result object as copy of four |
| 27 | std::cout << "Result is " |
| 28 | << result.multiply(5).add(six).multiply(5).add(7).multiply(5).add(eight).getValue() |
| 29 | << std::endl; |
| 30 | } |