Search⌘ K

Challenge: Design a Calculator

Explore how to build a calculator in C++ by writing functions that handle addition, subtraction, multiplication, and division. Understand function declarations, parameter passing, and how to return results based on operator input, enhancing your practical coding skills.

Problem statement

The aim of this challenge is to design a calculator that takes operands in its input and performs one of the following operations on them:

  • Addition
  • Subtraction
  • Multiplication
  • Division

test function

You have to write a function test that takes two values of type double and one value of type char in its input parameters.

  • number1 and number2 take the values of the operands.

  • operate can take ++, ...