Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

C++ visual studio functions and arrays

1.  Write acomplete program that receives a single phone number from the keyboard as astring and then passes it to a filter function (by reference).  The function should ERASE all non-numericcharacters from the parameter string.  Asa result, the original string variable should now contain numeric-only characters. 

If the number of digits in the filtered phone number is not 7 or 10, an errormessage should print. 

If the number of digits is 7, the number should print in the form:  xxx-xxxx

If the number of digits is 10, the number should print in the form: (xxx)xxx-xxxx

3 sample traces:

   Enter a phone number:  717.774.4464

  (717) 774-4464

 Enter a phone number:  774  4464

  774-4464

  Enter a phone number:  4464

  Not a valid phone number

2.  (Arrays,Searching and Sorting)  Write a completeprogram that receives a series of student records from the keyboard and storesthem in three parallel arrays named studentID and courseNumber and grade.  All arrays are to be 100 elements.  The studentID array is to be of type int andthe courseNumber and grade arrays are to be of type string.

The program should prompt for the number of records to be entered and thenreceive user input on how many records are to be entered.  That value should be used in an input loop toreceive the series of records and store them in the parallel arrays.

Add a function to printoutall records stored in the array.  Onlyprint records that were input from the keyboard.  Much of the arrays will be unused.  Add another function to search the arraysusing a specific student ID and display the student’s ID, course number, andgrade wherever found, OR the message “<student ID> doesn’t exist inarray”

Add code in main to printall records and prompt a user to enter a student ID and search for it in thearrays.  Test both possible outcomes.

Sample trace:

Enter the number of records to be input: 6

Enter record 1 (student ID, Course number and grade):  12 COSC175 A

Enter record 2 (student ID, Course number and grade):  15 COSC175 B

Enter record 3 (student ID, Course number and grade):  22 COSC175 C

Enter record 4 (student ID, Course number and grade):  12 ENG317  A

Enter record 5 (student ID, Course number and grade):  15 ENG317  A

Enter record 6 (student ID, Course number and grade):  12 PSYC101 A

Enter a student ID for a record search: 12

12 COSC175 A

12 ENG317 A

12 PSYC101 A

Note: If asearch had been made for 17, the message “17 doesn’t exist in array” would havebeen displayed.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question