Question
C++ Program Unlike the USA postal zip codes, Canada's postal codes arealphanumeric. The Canadian postal code uses a six-character stringand are in the format A1A
C++ Program
Unlike the USA postal zip codes, Canada's postal codes arealphanumeric. The Canadian postal code uses a six-character stringand are in the format A1A 1A1, where A is a letter and 1 is adigit, with a space separating the third and fourth characters.Write a program that reads a list of Canadian Postal Codes from thefile "PostalCodes .txt", and then verifies whether the postal codeis valid or not. Your program should use manipulators from tooutput the results to the console in a table format as shown in thesample output.
a. You can use the length() function of the string class to getthe length of a string.
b. Even if you are using a string type variable, you can stilluse a subscript to access an individual character in that stringbecause the variable is actually stored internally as a characterarray.
c. You can use the isalpha(char) function to determine whether acharacter is an alphabet.
d. You can use the isdigit(char) function to determine whether acharacter is a number.
e. Remember to include
PostalCodes.txt
S4S 4S4AbC 123S4S4S4123456ABC DEFS4S 4S4aAbc 4S4S4S 123S4Sb4S4S0G 4A0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started