header

Homework 7

Output Requirements

The telephone digit corresponding to a given letter of the alphabet.

Input Requirements

A letter of the alphabet (either uppercase or lowercase).

Processing Requirements

Each of the numerals '2' through '9' in a telephone "number" corresponds to three or four letters of the alphabet as shown below. Given the letter entered by the user, your program should determine the corresponding numeral and display it.

Miscellaneous

Using the C++ function, tolower, simplifies the processing. If ch is a character variable, the function

tolower(ch)

returns the corresponding lowercase value. More specifically, if ch is an uppercase letter of the alphabet then tolower returns the corresponding lowercase letter. For example, if 'A' is stored in ch then tolower(ch) returns the character 'a'. Otherwise, the tolower function returns its argument unchanged. So, for example, if ch is 'a' then tolower(ch) returns 'a' and if ch is '3' then tolower(ch) returns '3'.

I've written some of this program for you in Hmwk07.cpp. Download this file and complete the section that implements the processing requirements and the section that generates the output.

Sample Run

Sample Run