Exercise 2: Implementing Calculator
In this exercise, you are required to implement a calculator by using Switch statements
We'll cover the following
Problem Statement
Write a code which will take:
-
Two
float
type variables namednum1
andnum2
-
a
char
type variable calledOperator
-
The
Operator
variable can be passed the following:+
,-
,*
and/
-
Use
switch
statements to compute:- addition,
- subtraction,
- multiplication
- division
Get hands-on with 1400+ tech skills courses.