Complete a program that allows the user to choose addition or subtraction operations on two numbers entered from the keyboard. Code getChoice as a function that returns choice, addition and subtraction as functions that accept the two numbers as parameters and return the results of the calculations, and displayResult as a void function that accepts the result as a parameter. Be sure to put your name as a comment at the beginning of your code and at the end as the programmer.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 9PP
icon
Related questions
Question

C++ beginner 

HOMEWORK #6 PART 1
Please enter 1 if you want to add two numbers
enter 2 if you want to subtract two numbers 2
Please enter two numbers 4.65 9.2
The result is -4.55
Programmer: insert your name here
Transcribed Image Text:HOMEWORK #6 PART 1 Please enter 1 if you want to add two numbers enter 2 if you want to subtract two numbers 2 Please enter two numbers 4.65 9.2 The result is -4.55 Programmer: insert your name here
HOMEWORK 6 PART 1
Planning - Flow Charts
Date Due: Wednesday, April 14, 2021 at 11:59pm
addition
subtraction
getChoice
Complete a program that allows the user to choose addition or subtraction
operations on two numbers entered from the keyboard. Code getChoice as a
function that returns choice, addition and subtraction as functions that accept the
two numbers as parameters and return the results of the calculations, and
displayResult as a void function that accepts the result as a parameter. Be sure to
put your name as a comment at the beginning of your code and at the end as the
(num1, num2)
(num1, num2)
Ask user for
Result =
Result =
choice of
operation
num1+num2
num1-num2
programmer.
Input
Process
Output
1. Choice of
1. If choose to perform
1. Result of operation
Input
operation
2. First number
operation, add two
numbers; otherwise,
Return
Return
choice
(result)
(result)
3. Second number
subtract two numbers
main
Planning
- Breaking Program to Smaller Pieces
Return
Print
(choice)
title
getChoice
Main
displayResult
(result)
Get 2 numbers
Input
Process
Output
Choice is add
Display
subtraction
addition
result
getChoice
getNumbers
addition
subtraction
displayResult
displayResult
Return
Display name
end
Transcribed Image Text:HOMEWORK 6 PART 1 Planning - Flow Charts Date Due: Wednesday, April 14, 2021 at 11:59pm addition subtraction getChoice Complete a program that allows the user to choose addition or subtraction operations on two numbers entered from the keyboard. Code getChoice as a function that returns choice, addition and subtraction as functions that accept the two numbers as parameters and return the results of the calculations, and displayResult as a void function that accepts the result as a parameter. Be sure to put your name as a comment at the beginning of your code and at the end as the (num1, num2) (num1, num2) Ask user for Result = Result = choice of operation num1+num2 num1-num2 programmer. Input Process Output 1. Choice of 1. If choose to perform 1. Result of operation Input operation 2. First number operation, add two numbers; otherwise, Return Return choice (result) (result) 3. Second number subtract two numbers main Planning - Breaking Program to Smaller Pieces Return Print (choice) title getChoice Main displayResult (result) Get 2 numbers Input Process Output Choice is add Display subtraction addition result getChoice getNumbers addition subtraction displayResult displayResult Return Display name end
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Stack operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning