Question: 2. Unlike the USA postal zip codes, Canada's postal codes are alphanumeric. The Canadian postal code uses a six-character string and are in the format

 2. Unlike the USA postal zip codes, Canada's postal codes arealphanumeric. The Canadian postal code uses a six-character string and are in

2. Unlike the USA postal zip codes, Canada's postal codes are alphanumeric. The Canadian postal code uses a six-character string and are in the format A1A 1A1, where A is a letter and 1 is a digit, with a space separating the third and fourth characters. Write a program that reads a list of Canadian Postal Codes from the file "PostalCodes.txt", and then verifies whether the postal code is valid or not. Your program should use manipulators from siomanip to output the results to the console in a table format as shown in the sample output. Hints a. You can use the length) function of the string class to get the length of a string b. Even if you are using a string type variable, you can still use a subscript to access an individual character in that string because the variable is actually stored internally as a character array c. You can use the isalpha(char) function to determine whether a character is an alphabet. d. You can use the isdigit(char) function to determine whether a character is a number e. Remember to include S4S 4S4 Valid AbC 123 Invalid S4S4S4 Invalid 123456 Invalid ABC DEF Invalid S4S 4S4a Invalid Abc 4S4 Invalid S4S 123 Invalid S4Sb4S4 Invalid SeG 4A0 Valid Done

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!