CIS170C All Assignments CIS170C All Assignments | Page 27
4
G H I 9
W X Y Z
If the digit entered is not one of the valid digits or one of the valid letters, return –1 by value
indicating that you have an invalid digit.
A phone number never begins with a 0, so the program should flag an error if such a number is
entered. Make ReadDials() return –2 in this case.
A phone number never begins with 555, so the program should flag an error if such a number is
entered. Make ReadDials() return –3 in this case.
A phone number always has a hyphen (-) in the 4th position. Make ReadDials() return –4 in this
case (if it doesn't have a hyphen in the 4th position). If a hyphen is in any other position, it is
considered an invalid digit.
If the phone number is valid, the main calls the AcknowledgeCall function to write the
converted number to the output file.
All the logic of the program should be put in functions that are called from Main(): ReadDials()
and AcknowledgeCall().
The ToDigits() function is called from the ReadDials() function and is used to convert each letter
entered individually into a digit and to verify that the user has entered a valid phone number.
Have the program work for any number of phone numbers.
In the ToDigits() function uses the toupper function to convert any letters entered to
uppercase. All the error messages are to be written to the output file from main() based on the
return value from the functions.