YCP Logo Lab 5: Expensive Calculator

Expensive Calculator

Your task in this lab is to read two double values from the user, and print out their sum, difference, product, and quotient.

Here is an example run of the program (user input in bold):

Enter first value: 8.5
Enter second value: 4
8.500 + 4.000 = 12.500
8.500 - 4.000 = 4.500
8.500 * 4.000 = 34.000
8.500 / 4.000 = 2.125

Each quantity printed should have three digits of precision after the decimal point.

Getting started

Start by downloading CS200_Lab5.zip and using the File->Import... menu option to import it into Visual Studio. Add your code to the source file Calculator.c.


Store the two input values in variables of type double.

Use the printf function to prompt the user for the two values and also to print out the computed results. The %f conversion specifier may be used to print values of type double.

Use the scanf function to read values typed by the user into your double variables. Use the %lf conversion specifier (that's "percent", "lower-case L", "lower-case F"). Note: the %f conversion specifier will not work correctly for a double variable.


When you are done, choose Tools->Submit to submit your completed lab to the server. You will need to enter your Marmoset username and password.