Tuesday, October 11, 2011

Quiz #1 - results

The results for this first quiz were fairly well mixed. Some students had a firm grip on the logical operators and produced complete and correct output. Some students had mostly correct output with one or two errors. Some students were able to correctly use cout to send text to the console but couldn't remember the truth tables. All in all, not unexpected results for a first quiz.

Monday, October 10, 2011

Enhanced telephone digits

Example 5-5 in the textbook (pp 241-242) asks the user to enter an uppercase character and returns the corresponding number from the telephone keypad. If you would prefer to make the code case-insensitive, you could add the following to the program in the book.

rand() and srand()

Sometimes you need to generate a random number. In C++, the easiest way to do this is to invoke the rand() function from the cmath library. This method returns a value from [0 - 32767] but you can use a little mathematical

Here are some examples and what they return:

Lab 5 - reverse digits

You are to complete exercise 2, p 300.

You will need to employ a while loop and use the modulus operator and integer division.

Lab 4 - Cartesian coordinate system

You are to complete exercise 7, p 226.

You will need to use a combination of if/else if and the logical AND operator to determine where the user's point is located in the Cartesian coordinate system.

Lab 3 - salary increases

You are to complete exercise 6, p 165.

Lab 2 - miles per gallon program

You are to finish completing exercise 20, p 27 by creating a working console application which implements the algorithm which you developed as the solution to the problem for Lab 1.