Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a complete C++ program to perform arithmetic operations. You must include function named calc() which accepts an arithmetic operator (+ /) and two operands

image text in transcribed
Develop a complete C++ program to perform arithmetic operations. You must include function named calc() which accepts an arithmetic operator (+ /) and two operands as input parameters. Function calc() should return the answer of applying the operator to the operands using reference parameter. For example, with variable declarations float a, b, ans; the function can be called by using calc(a, '*', b, ans) to calculate the expression a multiplied by b and the result is stored in ans. This program will prompt the user to input two float values, and then calls functions calc() four times to return the addition, subtraction, multiplication and division of the two input values Sample output: Enter two values: 3 7 Addition: 3 + 7 = 10 Subtraction: 3 - 7 = -4 Multiplication: 3 * 7 = 21 Division: 3 / 7 = 0.428571

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

Students also viewed these Databases questions

Question

=+different from manpower planning (MP).

Answered: 1 week ago

Question

3. Influencing people to willingly follow that direction?

Answered: 1 week ago

Question

7. How might you go about testing these assumptions?

Answered: 1 week ago