Program that can serve as a simple calculator

Assignment Help C/C++ Programming
Reference no: EM13165391

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by a second number. The result of one of these operations becomes the new value of result. The calculation ends when the user enters the letter R for "result" (either in uppercase or lowercase). The user is allowed to do another calculation from the beginning as often as he or she wants. Use the scanf for input.

The input format is shown in the following sample dialog. If the user enters any operator symbol other than +, ?, *, or /, then display message "UnknownOperatorException is thrown " and the user is asked to reenter that line of input..

Calculator is on.
result = 0.0
+5
result + 5.0 = 5.0
result = 5.0
*2.2
result * 2.2 = 11.0
result = 11.0
% 10
% is an unknown operation
Reenter, your last line:
* 0.1
result * 0.1 = 1.1
result = 1.1
r
Final result = 1.1
Again? (y/n)
yes
result = 0.0
+10
result + 10.0 =10.0
result = 10.0   
/2
result / 2.0 = 5.0
updated result = 5.0
r
Final res

Reference no: EM13165391

Questions Cloud

Evaluate and use quantitative and qualitative information : Evaluate and use quantitative and qualitative information to measure financial and non financial performance of an organisation
Integer arguments representing feet : A constructor that will take a single integer argument representing a whole number of feet • A constructor that will take two integer arguments representing feet and inches respectively • A constructor that will take three integer arguments represent..
Program to generate a star-based histogram for a quiz : Write a C++ program to generate a star-based histogram for a quiz (maximum score possible is 5) given to a class of N students, where N is an input from the user. Use arrays for computation.
State newton''s third law of motion : Newton's third law of motion can be stated like this: "For every action, there is an equal and opposite reaction." How are Le Chatelier's Principle and Newton's third law similar? How are they different?
Program that can serve as a simple calculator : Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..
Determine the center temperature of the product : Determine the center temperature of the product afer 60 minutes if the convective heat transfer coefficient between the product and mbient air is 25 W/m^2 K.
How do a bubble sort in mips? : How do a bubble sort in MIPS?
Commercial tablet was determined by titration : The amount of aspiring (molar mass of 180.15 g/mole) in a commercial tabletwas determined by titration with NaOH. What mass of aspiring was in a tablet if 15.00 mL
Store a list of student info : Store a list of student info, (id number, First name and Last name) using a link list. The ID is the key field. The program should implement a linked list using arrays.The program should process the following operations

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write c program which compute acceleration of jet fighter

Write a C++ program which compute the acceleration (m/s 2) of jet fighter launched from aircraft-carrier based catapult, provided jet's takeoff speed in km/hr

  Demonstrate the construction and output of an array

In fluid mechanics, the Reynolds number (Re) is a dimensionless quantity that is used to help predict similar flow patterns in different fluid flow situations. For example, Reynolds numbers can be computed for different velocities of fluid flow over ..

  Implement a function to recursively

Implement a function to recursively determine if a word is a palindrome. A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

  Input parameters, and returns nothing

Write a function called ten2one(), that takes no input parameters, and returns nothing (void). The body of the function must include a loop that counts from 10 down to 1, printing the count value each time in the loop. The output should look like (no..

  Draw the heap

Eric Rowe Starting with an empty minheap, draw the heap after each the completion of the following operations  and repeat for a maxheap (replace removeMin() with removeMax()). Upload your drawings here. Hand drawn is fine:

  Prepare a program that uses at least two functions

Prepare a program that uses at least two functions that can be called from your main.

  Program to add numbers and display sum

For each of problems write C++ code to do the required task. Receive the number and find out whether it is odd or even.

  Add the correct code to fill the matrix array with the value

Use the file below code and add the correct code to fill the matr2 array with the values that make it the matrix transpose of matr1. There are many examples on the Internet that show how to do this in C++ and what it should look like when it is corre..

  The use of decision logic

The use of decision logic is one of the major concepts of computer programming.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd