Menu

Please Write C Program Perform Following 6 Operators 2 Numbers N1 N2 Need Prompt User Ente Q43788789

Please write a C++ program that can perform thefollowing 6 operators for 2 numbers: N1 and N2. You need to promptthe user to enter the first number, an operator, and the secondnumber. Please see the sample test below to design your applicationprogram properly. This program is a calculator forusers to enjoy.   You must thank the user and stop yourprogram when the operator entered is ‘@’.

The 6 valid operators for this simple calculator are asfollows:

  1. + for addition of N1 and N2. Therefore, result= (N1 + N2).
  2. for subtraction of N2 from N1. Therefore,result = (N1 – N2).
  3. * for multiplication of N1 with N2. Therefore,result = (N1 * N2).
  4. /   for floating-point division ofN1 by N2. If N2 is zero, please

           say“The second number cannot be zero!”, else result = (N1 / N2).

  1. ** for power N2 with base N1 (i.e.,N1N2). Therefore, result = ( N1 ** N2 ).
  2. % for division remainder (i.e., modulus) of N1by N2. If N2 is zero, please

      say“The second number cannot be zero!”, else result = ( N1 % N2 ).

  1. @ for stopping the calculator game. You mustthank the user before leaving this program.   
  2. Otherwise, please say “Sorry, ____ is not a valid operator!”.  Please show this invalid operator.

===========================================================================.

The following is a sample standard test, which must be yourtest case #1. You must also do test case#2 and test case #3 with different set ofdata. Each of your test case must cover all 6 valid operators (atleast once for each) plus an invalid one.

Welcome to the the program of “Your firstname Yourlastname” !!!

Enter your first number: 10

Enter your operator: +

Enter your second number: 90

Result: 10.0 + 90.0 = 100.0

Enter your first number: 55

Enter your operator: –

Enter your second number: 49.5

Result: 55.0 – 49.5 = 5.5

Enter your first number: 12

Enter your operator: *

Enter your second number: 55

Result: 12.0 * 55.0 = 660.0

Enter your first number: 99

Enter your operator: /

Enter your second number: 0

The second number cannot be zero!

Enter your first number: 99

Enter your operator: /

Enter your second number: 8

Result: 99.0 / 8.0 = 12.375

Expert Answer


Answer to Please write a C++ program that can perform the following 6 operators for 2 numbers: N1 and N2. You need to prompt the u…

OR