Answered step by step
Verified Expert Solution
Question
1 Approved Answer
b) 1. Write a calculator program which prompt user to insert two integer values and one character value which determine the action of calculation and
b) 1. Write a calculator program which prompt user to insert two integer values and one character value which determine the action of calculation and display the result of calculation. This program should have the following functions: a) main - This function calls function getInput to get two numbers and an operation from a user. It also call function calculate by passing 3 arguments which are first number, second number and operation. Finally it calls function displayResult to display the result of the calculation. This input and calculation processes are repeated until the user choose to stop. getInput - This function reads two(2) numbers and an operation from the keyboard. It uses pointers to read the first number, the second number, the operation and place them in the calling function's variables(use pass by reference) calculate - This function calculates the result of the operation selected by the user for the two numbers. It uses pointers to store the first number, the second number and the operation sent by the calling function and to return the result of the operation to the calling function. d) displayResult - this function will display the result of the selected operation on the screen. c) MENU + : Add - Subtract *: Multiply /: Divide X: Exit Enter your choice : + Enter first number 10 Enter second number : 5 10 + 5 = 15 Enter your choice :- Enter first number 12 Enter second number : 6 12 - 6 - 6 Enter your choice :x
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started