Question: The game plan is to prompt the user for data, store the data temporarily in memory, then write the data to file. After the data
The game plan is to prompt the user for data, store the data temporarily in memory, then write the data to file. After the data has been saved, read it back from the file and compare the two copies. 1. Create a Point struct. It should store two coordinates, x and y. 2. Using the example source for this chapter, prompt the user to input 7 (x,y) pairs. As the data is entered, store it in a vector of Points called original_points. 3. Print the original_points vector. 4. Open an ofstream and output each point to a file named mydata.txt. 5. Close the ofstream and open an ifstream to mydata.txt. Read the data from mydata.txt and store it in a new vector called processed_points. 6. Print the data elements from processed_points. Example output: > ./point Enter 7 integer pairs, separated by a space: Pair 1: 0 1 Pair 2: 2 3 Pair 3: 3 4 Pair 4: 4 5 Pair 5: 6 7 Pair 6: 7 8 Pair 7: 13 21 Points entered: 1: 0, 1 2: 2, 3 3: 3, 4 4: 4, 5 5: 6, 7 6: 7, 8 7: 13, 21 Points read back in from file: 1: 0, 1 2: 2, 3 3: 3, 4 4: 4, 5 5: 6, 7 6: 7, 8 7: 13, 21 You may find the starter files associated with the lab useful, but you are under no obligation to use them. If you do choose to use them, then your only task is to implement point.cpp.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
