Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
1. (10 points) Write a C++ program named hw3_1.cpp that emulates a simple calculator. First, your program prompts a user to enter a math operation
1. (10 points) Write a C++ program named hw3_1.cpp that emulates a simple calculator. First, your program prompts a user to enter a math operation to be performed. Then, it asks for two numbers to perform the operation on. If the user types in an operator that we haven't specified, you should print out an error message, as seen below. The following shows a sample execution of your program. When the instructor runs your program for grading, your program should display the result as below. Note that the boldfaced numbers are entered by a user. Welcome to the Hartnell Calculator Enter operation to be performed (Note you must type in a+,,, or 1 ): * Enter the first number: 20 Enter the second number: 15 2015=300 Here is another sample run, this one with an incorrect operator Welcome to the Hartnell Calculator Enter operation to be performed (Note you must type in a +,,, or /1 : \# Sorry, this isn't a valid operator. Another sample run Welcome to the Hartnell Calculator Enter operation to be performed (Note you must type in a +,,+, or /1 : / Enter the first number: 3.5 Enter the second number: 2.0 3.5/2=1.75
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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