Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will write a program that works as a basic calculator. Please do the following for full credit: Create four different functions:

For this assignment, you will write a program that works as a basic calculator. Please do the following for full credit:

Create four different functions: add, subtract, multiply, divide. Each function should take it two float variables as input parameters. Each function should then perform their corresponding operation on the two values. For subtraction, just do the first parameter minus the second parameter. For division, the first parameter should be the numerator and the second parameter the denominator. Each function should then return the resulting float answer. There should not be any scanfs or printfs inside of these functions.

Then write a main function that continuously loops. Inside the loop, present a menu that asks the user to either do addition, subtraction, multiplication, division, or quit the program. Let the user choose their option and then prompt them for the two operands (the numbers) to pass along to the appropriate function based on their input. After the function returns the answer, print out the result in the main function.

The following will result in no credit for the assignment:

  • Declaring any global variables.
  • Using printf or scanf inside of the math functions.

If you wish to add more functions to your program, you are free to do so, but the four mentioned above must be in the program.

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions