Question: CS 135 Lab week #5 In this week's lab, takes as input two operands as double 111 be writing an interactive program that values and
CS 135 Lab week #5 In this week's lab, takes as input two operands as double 111 be writing an interactive program that values and one operand s a char. It wi22 then calculate and output the result of applying the operator to the two operands The program must do the following ' Prompt the user for the value of the 2 operands and store in a double value After each operand input, check to make sure that cin.fai1 does not retu rn true. If it does, the user has entered an input that cannot be placed into the double variable. You should output an error message and immediately end the program withs return 1 and store it in a Prompt the user for one of the four operands char variable Use an if statement to compare the value of the input to '+". '-,,,, and and perform the appropriate calculation. . In the case that the input does not match any of the four operands, output an error message. .In the case of division/),if the user inputs a value of 0.0 normal. Instead, the answer should be output as "infinite". for the second operand, you should not perform the division as Output for each calculation must be in the following form: operand! operator operand2 - result Once the program is working, show both the code and the output to your lab instructor Your finished program should look similar to these examples: EXAMPLE Input First Value: 12.6 Input Second Value: 44 Operation to perform (, 12.644554.4 EXAMPLE Input First Value: 100.5 Input Second Value: 0 Operation to perform t-./, 100.5/0-infinity EXAMPLE Input First Value: h Invalid input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
