csci 20 :: book learning challenge 3 (due tues, feb 9)

Complete this exercise on your own.

(1) Fill in all of the "Answer" boxes, (2) press "Prepare for printing", then (3) print the answer grid.

Staple all pages together and submit to the instructor on the date listed above.

Questions:

Read Operators, Operators, Arithmetic operators, Compound assignment, Type conversion and answer the following:

1. Write a C++ statement below that multiplies numberOne and numberTwo together and assigns the result to result. What will the value of result be after the assignment?
int numberOne = 7;
int numberTwo = 3;
int result = 0;
2. Write a C++ statement below that subtracts numberTwo from numberOne and assigns the result to result. What will the value of result be after the assignment?
int numberOne = 99;
int numberTwo = 98;
int result = 0;
3. Write a C++ statement below that divides numberOne by numberTwo and assigns the result to result. What will the value of result be after the assignment?
int numberOne = 25;
int numberTwo = 7;
int result = 0;
4. What is the value of result after the following statement? How does your text describe the purpose of the operator % (also called modulo or modulus operator)?
int result = 25 % 7;
5. What is the value of result after the following statement?
int result = (5 / 10) * 100;
6. What is the value of result after the following statement? If the result is different from the question above, briefly explain why the result was different.
int result = (5 / 10.0) * 100;
7. What is the value of result after the following statement? What is the term used to describe the operation that static_cast<double> performs? What is the purpose of this operation?
int result = (static_cast<double>(5) / 10) * 100;
8. Name and briefly describe the purpose of the ++ and -- operators.