Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please The XML. (eXtensible Markup Language) is a common format used to structure and store data on the Web. The address.xml file on the

image text in transcribed
image text in transcribed
C++ please
The XML. (eXtensible Markup Language) is a common format used to structure and store data on the Web. The address.xml file on the website provides a small sample XML file that could be used to store names in an address book. Either type the file in nano (with spaces tabs appropriately) or copy i over to your project deectory, and save to a file named address. xal The sample file contains four contacts. The tag denotes the start of a field and the tag denotes the end of the field. You are hosting a party in Palmdale, CA. Write a program that reads in the address.xml file and outputs the names and addresses of everyone in Palmdalk. Your program should not output any of the tag information, just the address content Sccond, you would like to send an advertising flyer to everyone in rip codes 90210 through 90214 Next, modify your program to also output the names and addresses of everyone whose zip code falls within the specified range. You may assume that cach contact in the address file has the same structure and the same fields. However, your programming solution must be able to handle an input file with any number of sontacts Useful Use vector strings to solve the problem, along with member functions of the string libeary. string functions and member functions may include geti ine() . . find().size(). substr(), and .pushback () for vocton Ifoundeasiest to declare a separate string vectors to store the names, streets, citics, states, and rip codes Finally, use the following function prototypes: /T If a valid contact is foand s gethane) extracts the contact nane from the file // and pushes it t a #tring vector void getNane(fstrean sfin, vectorestring nane) // getStreet() extracts the street and pushes it to atring veetor void getstreet (ifstream stin, vectorestring istreet) getcity) extracts the city and pusbes it to a string vector void getcity(ifstream &fin, vectorcatringo seity) // getstate) extracts the state and pashes it to a string vector vold getState(ifstrean &tin, vectorcatring atate) getzip) extracts the zip code and pushes it to a string vector void getzip(ifstream stin, vectorestring zip) When opening the file, the program should fail gracefully if the address.xml fails to open. If you execule the program, the following information should be displayed: -> main. Palmdale Addresses Cathy Pearl 05 A St Palndale, CA 93352 Hendy Jones 982 Boundary Ave Palmdale, CA 93354 Advertising to 90210-90214 George Clooney 1042 EI Camino Real Beverly ills,CA 90214

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions