header

Homework 14

This is a modification of Homework 10. All of the specifications in that assignment also apply to this assignment. In addition, you are to use parallel arrays; one to store the letters entered by the user and the other to store the corresponding numerals. Replace the value-returning function "numeral" with a void function named "findNumerals". This function has two in parameters (the array of letters, and the number of letters currently stored in the array) and one out parameter (the array containing the corresponding numerals). The purpose of this function is to go through the array of letters and find the corresponding numerals. If one (or more) of the characters in the array of letters is not really a letter of the alphabet then the corresponding numeral should be the asterisk character (*).

Write a void function that gets the letters from the user and stores them in the array of letters. Write another void function whose sole purpose is to generate the output.

Output Requirements

For each letter in a sequence of letters, display the corresponding telephone numeral. The sample run below indicates what your program should look like when it executes.

Given a sequence of letters, this application will find the
corresponding digits on the telephone.

Enter a sequence of letters: Asbury

The letter A corresponds to the numeral 2
The letter s corresponds to the numeral 7
The letter b corresponds to the numeral 2
The letter u corresponds to the numeral 8
The letter r corresponds to the numeral 7
The letter y corresponds to the numeral 9


Press Enter to return to Quincy...

Input Requirements

A sequence of letters (either uppercase or lowercase). The user will enter the letters all at once on the same line. You may assume that the user enters only letters of the alphabet.

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. For each letter entered by the user, your program should determine the corresponding numeral.