Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please Write a program that will simulate a simple calculator. There will be four options: add two numbers, subtract two numbers, square root

image text in transcribed

In C++ please

Write a program that will simulate a simple calculator. There will be four options: add two numbers, subtract two numbers, square root and raise to the power. During the subtraction option, you should not get any negative numbers when subtracting. For example, if we subtract 4 - 7 you should get 3 not negative 3. Tip: use the absolute value function. You will use a switch case statement to create the selection mechanism. You will use three predefined functions we have used from chapter 4. The program will loop as long as the user types in Yory for yes. You must include comments, failure to do so will vastly affect your grade. Once you are done, submit in a.cpp file. You do not need to show me the running program. I will check to see that it runs as I am grading your lab. Select a an option (1-4) from the following 1. Addition of two number 2. subtraction of two positive numbers 3. Square root of a number 4. Raise to the power 1 You chose to add two number Enter the first number 2 Enter the second number 2 The addition of the two numbers is 4 Do you want to run this program again? This program functions as a small calculator Select a an option (1-4) from the following 1. Addition of two number 2. subtraction of two positive numbers 3. Square root of a number 4. Raise to the power 2 You chose 2 to subtract two positive numbers Enter the first number 4 Enter the second number 5 The subtraction of these two numbers is Do you want to run this program again? 1

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions