Question: Write a C++ program to create a simple calculator to add, subtract, multiply, divide, find the power of number, and calculate the average of numbers.

Write a C++ program to create a simple calculator to add, subtract, multiply, divide, find the power of number, and calculate the average of numbers.

You should use switch and break statement to choose the operation.

This program takes an arithmetic operator (+, -, *, /, p, a) and operands from a user and performs the operation on those operands depending upon the operator entered by user.

The operator should be a char type and one of (+, -, *, /, p, a) characters with the following meanings:

+ for addition (num1 + num2)

- for subtraction (num1 - num2)

* for multiplication (num1 * num2)

/ for division (num1 / num2)

p for power (num1 ^ num2)

a for Average of numbers. The program should ask the user the number of values he wants to find the average for them.

All operation should implemented using functions.

The program should ask the user if he wants to run the program again.

Submission Instructions

This is an individual assignment.

Please submit your program (the C++ files) in Blackboard.

Make sure that you include your student ID, name and section number as comments at the beginning of each file. Files submitted without this information will simply be discarded.

Any later submissions will not be accepted.

The program should be in good programming practice (design, indentations, identifiers names, comments, etc.) with proper documentation and comments.

Cheating and copying codes from books, students, internet, etc., is not allowed.

If required, your instructor may request to meet you to discuss and review your submission. Not attending the meeting considers your submission as not complete.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!