Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ 8 pts.) Write two functions: one will read a tab-separated ( t; tabs are whitespace) input data file that contains location data and

In C++image text in transcribed

8 pts.) Write two functions: one will read a tab-separated ( t; tabs are whitespace) input data file that contains location data and which populates a vector that stores the data structures that hold each row of data, and one that will display those vector items which match a filter requirement. The Input File Each line of the file is formatted as shown below. There is no header line in the input file. Each line of the input file should be represented as a Location struct. Note that there is no whitespace within the latitude, longitude, or time_zone valus.(See the example data file.) You can assume a Location struct is defined containing the 3 fields: lat, 1on, and tz. read_data Function Implement the read_data function. Your implementation should accept the input stream and a vector for the data. The function should populate the vector and return nothing. You may assume the input stream has been correctly opened already! display_match Function Implement the display match function. Your implementation should accept the data vector and a string value. Print any vector items foutput any format you wish, but include all values in the output of each item) which have a time zone that is equal to the string parameter. The function. does not return a value. Example of calling the read_data and display_match functions from main As an example, the functions could be called as: int main() \{ vector my_data; ifstream ifs ("input,txt"); read_data(ifs, my_data); display_match(my_data, "Europe/Moscow"); Example of the input file \( \begin{array}{lcl}48.8959487 & 2.2679278 & \text { Europe/Paris } \\ 56.4177803 & 21.8525134 & \text { Europe/Vilnius } \\ 30.741991 & 121.341969 & \text { Asia/Chongqing } \\ 30.5395376 & -8.5055146 & \text { Africa/Casablanca } \\ 60.1161159 & 30.2124344 & \text { Europe/Moscow } \\ -6.7191062 & 108.5329338 & \text { Asia/Jakarta } \\ 45.5593978 & -122.807445 & \text { America/Los_Angeles } \\ 24.4623104 & 118.0801092 & \text { Asia/Chongqing } \\ 54.659677 & 51.5020158 & \text { Europe/Moscow }\end{array} \) Example output Europe/Moscow: 60.1161,30.2124 Europe/Moscow: 54.6597, 51.502

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Why is positioning so critical to effective IMC in building brands?

Answered: 1 week ago