Create the equivalents of a four-function calculator. The program should request the user to enter a number, an operator, and another number. (Use floating point). It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. Use switch case statement to select the operation. Finally display the result.
When it finishes the calculation, the program should ask if the user wants to do another calculation. The response can be ‘y’ or ‘n’.
Sample Output
Some sample interaction with the program might look like this:
Enter first number, operator, second number: 10/3
Answer: 3.33333
Do another (y/n)?y
Enter first number, operator, second number: 12+100
Answer: 112
Do another (y/n)?n
Write a programe in c++ using " switch case "?
You aren't seriously suggesting we do your homework are you? I will but it will cost you $100 US and you will fail the exam 'cause you didn't learn anything.
If you want info on the 'switch statement' see below.
Reply:Programmers usually expect to be paid for their services, especially when I (or we) do all the work.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment