Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To complete the lab make the following modifications to the calculator program: When the user enters their choice for the calculator operation (+, -, *,

To complete the lab make the following modifications to the calculator program:

When the user enters their choice for the calculator operation (+, -, *, or /) it should be a number between 1 and 4 (or 0 and 3). In the original version of the program if the user entered an illegal value no operation was performed. Modify the program so that anytime the user enters an illegal operation an error message is printed and the user is asked for a new value. This will require adding a loop whose condition is based on the user's choice.

In the initial version of the program it would perform one operation and then exit. Change the program so that when it finishes a calculation it asks the user if they want to perform another calculation. You can have the user enter a 0 for no and 1 for yes, or look up the char variable type so they can enter n or y.

Add an additional calculation to the calculator. This calculation should sum all of the integers between the two numbers the user entered (truncating the numbers if the user entered a decimal). For example, if the user entered 5.2 and 8.7 then the calculator should sum all of the values between 5 and 8 (i.e. 5 + 6 + 7 + 8). Remember that if you store a double value in an int variable it is automatically truncated.

image text in transcribed

#include using namespace std; int main()l double operandl; double operand2; int operation; cout operandl; cout > operand2; cout > operation; if ( operation = 1){ cout

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

discuss different sources of numerical data;

Answered: 1 week ago

Question

design and evaluate an effective survey instrument;

Answered: 1 week ago

Question

administer a survey to an appropriate sample of respondents;

Answered: 1 week ago