Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Use selection and repetition to write a program which uses functions Problem Statement A program is required which will act as a calculator. The

Goal: Use selection and repetition to write a program which uses functions

Problem Statement A program is required which will act as a calculator. The program should prompt the user to enter 2 integers and a code. The program should perform the following actions based on the code entered.

A code of 1 indicates that the two numbers should be added

A code of 2 indicates that the two numbers should be multiplied

A code of 3 indicates that the first number should be divided by the second number

A code of 4 indicates that the first number should be subtracted from the second number.

The program should then print both numbers, with appropriate labels as well as the sum, difference, product or quotient with an appropriate label indicating what is being printed. This process should be repeated until 2 zeros are entered. An appropriate message should then be printed to notify the user of the end of the program.

Sample Output

Please enter a number 3

Please enter another number 6

Please enter the code 1

The first number is 3 and second number is 6. The sum of these numbers is 9

Please enter a number 4

Please enter another number 5

Please enter the code 2

The first number is 4 and the second number is 5. The product of these numbers is 20

Please enter a number 0

Please enter another number 0

Good Bye!!

Your program MUST use at least 2 value return functions (excluding the main function) and must use a loop.

Deliverables Submit the following by 12:30 pm

Neatly drawn and labelled hierarchy chart in the space provided on this lab sheet. This should be drawn in pencil before you write any code

Completed C++ program with comments. The file name should be lastname1_lastname2_Week12.cpp

There should be comments at the top of the program which list the date, the authors and gives a brief description of the program

There should be comments before each function describing what the function is doing.

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

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

More Books

Students also viewed these Databases questions

Question

Describe the tax treatment of partnership distributions.

Answered: 1 week ago