Question: In this exercise, you modify one of the ZIP code programs from the chapter. If necessary, create a new project named ModifyThis19 Project and save

In this exercise, you modify one of the ZIP code programs from the chapter. If necessary, create a new project named ModifyThis19 Project and save it in the Cpp8\Chap13 folder. Enter the C++ instructions from Figure 13-13 into a new source file named ModifyThis19.cpp. Change the filename in the first comment. Save and then run the program. Test the program using the data shown in Figure 13-13 in the chapter. Now, modify the program so that it allows the user to enter either a five-character ZIP code or a nine-character ZIP code. Pass the number of characters in the ZIP code to the verifyNumeric function. Save and then run the program. Test the program appropriately.

Figure 13-13

1 //Modified ZIP Code.cpp 2 //displays a message indicating whether a ZIP code 3 //contains the appropriate number of characters 4 7/and whether each character is a number 5 7/Created/revised by  on  7 #include  8 #include  9 using namespace std; 10 11 //function prototype 12 char

1 //Modified ZIP Code.cpp 2 //displays a message indicating whether a ZIP

1 //Modified ZIP Code.cpp 2 //displays a message indicating whether a ZIP code 3 //contains the appropriate number of characters 4 7/and whether each character is a number 5 7/Created/revised by on 7 #include 8 #include 9 using namespace std; 10 11 //function prototype 12 char verifyNumeric(string zip); 13 14 int main() 15 { string zipCode ""; char isAl1Numbers 16 17 18 cout "Five-character ZIP code (-1 to end): "; cin >> zipcode; 19 20 21 while (zipcode != "-1") { if (zipcode.length () 23 24 5) == 25 cout "-->Correct number of characters"; isAlINumbers = verifyNumeric(zipCode); if (isAl1Numbers == 'Y') cout endl

Step by Step Solution

3.38 Rating (173 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ModifyThis19cpp displays a message indicating whether a ZIP code contains the appropriate number of ... View full answer

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 An Introduction Programming Questions!