I'm new to programming (only 4th week) and i am supposed to try and create a program that will... well ill just post what it wants as its alot. I'm just not sure how to get started on this as im drawing a blank on what to do. it is homework so im not looking for any "do it for me" help.
Write a program that simulates the dial of a phone number. The program will input a phone number and the program will acknowledge the call by either writing an error message or the 8 digit phone number to the console window. The phone number may have either digits, letters, or both.
Define a function named ReadDials() that reads each digit/letter dialed into 8 separate char variables (DO NOT USE ARRAYS). All digits are sent back through parameters by reference. Then, for each digit, the program will use a function named ToDigit(), which receives a single char argument (pass by reference) that may be a number or a letter of one of the digits dialed. If it is a number, return 0 by value indicating it is a valid digit. If the digit is a letter, the number corresponding to the letter is returned by reference and return 0 by value indicating it is a valid digit. Here are the letters associated with each digit.
0 5 J K L
1 6 M N O
2 A B C 7 P Q R S
3 D E F 8 T U V
4 G H I 9 W X Y Z
If the digit entered is not one of the valid digits or 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. Also 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 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, 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 to a digit and to verify the user has entered a valid phone number. Have the program work for any number of phone numbers. Continue processing until the user enters a Q.
In the ToDigits() function use the toupper function to convert any letters entered to uppercase. All error messages are to be written to the output file from main() based on the return value from the functions.
You will set up the 8 char variables to hold the digits of the phone number in main() and pass the variables to the functions by reference.