YCP Logo Lab 2: Integer Values

In this lab you will experiment with integer values.

Getting Started

Download CS200_Lab2.zip. Save it on the Desktop.

Start Visual Studio 2008. From the File menu, choose Import. Navigate to the Desktop and choose CS200_Lab2.zip. Click Open.

Under the Solution Explorer, expand the Source Files item and double-click on the Values.c item to open the C file.

Your Task

The goal of the lab is to add assignment statements to the main function in the C source file called "Values.cpp". Each of the int variables (a, b, c, d, e, and f) should be assigned values such that

  • a, b, c, and d are non-zero
  • e and f are positive (greater than zero)
  • a + b = 121
  • c + d = 0
  • e + f < 0

When you run the program (control-F5), you will see some test output. You have completed the exercise when the output looks something like this:

figures/lab2-consoleOutput.png

Note that test 3 is tricky: don't worry too much if you don't get it to pass - but you should think about how it is possible for the sum of two positive int values to be negative.

(Hint: Add #include <limits.h> to the top of your file and view its contents by right-clicking on it and selecting Open Document <limits.h> .)

Submitting

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.