5. Design a C++ program that simulates a simple calculator using switch structure. rogram will take two integer numbers as input and an operation as a character '+', ", , "%', 'T'. It will then perform that operation on both numbers and print the result. 1. For division avoid division by zero and should output the result in floating point, for example if n1= 5 and n2= 2 then it should print 2.5. (use typecasting for conversion) 2. If user enters 'P' print Power of two numbers. (use cmath pow function) 3. If user enters 'S' print square root of both numbers (use cmath sqrt function)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question
Q5. Design a C++ program that simulates a simple calculator using switch structure.
Program will take two integer numbers as input and an operation as a character '+', '',
**, "%', '"'. It will then perform that operation on both numbers and print the result.
1. For division avoid division by zero and should output the result in floating
point, for example if n1= 5 and n2= 2 then it should print 2.5. (use
typecasting for conversion)
2. If user enters 'P' print Power of two numbers. (use cmath pow function)
3. If user enters 'S' print square root of both numbers (use cmath sqrt
function)
Transcribed Image Text:Q5. Design a C++ program that simulates a simple calculator using switch structure. Program will take two integer numbers as input and an operation as a character '+', '', **, "%', '"'. It will then perform that operation on both numbers and print the result. 1. For division avoid division by zero and should output the result in floating point, for example if n1= 5 and n2= 2 then it should print 2.5. (use typecasting for conversion) 2. If user enters 'P' print Power of two numbers. (use cmath pow function) 3. If user enters 'S' print square root of both numbers (use cmath sqrt function)
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Algebraic Expressions
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