Homework 5


1. With super vision you look into your computer and see that a particular byte in memory has contents 00101011. If we interpret that byte as a char, what character does it represent? If we interpret that byte as a bool, what boolean value does it represent?

2. Convert each of the following binary numbers into an equivalent decimal number (base 10).  Show your work.

    (a) 10011101

    (b) 00100101

3. Convert each of the following decimal numbers into an equivalent binary number expressed as a byte.  Show your work.

    (a) 77

    (b) 253

4. Write a program that reads in a 3-letter word in lowercase letters and prints out the same word with the first letter capitalized. A typical run of the program should look like:

Input a 3-letter word in lowercase letters: cat
With leading letter capitalized this is   : Cat

Hint look at the ASCII table and think about how to go from the ASCII value of a lowercase letter to the ASCII value of the same letter in uppercase. For example, consider the effect of the following code:

char charUpper, charLower; 

charLower = 'd';

charUpper = charLower - 'a' + 'A';

cout << charLower << '' '' << charUpper << endl;


Turn in written answers to the first four questions, your source code, and a screen capture of your program running.