|
@@ -1,4 +1,4 @@
|
1
|
|
-#Arrays of Objects - PRMap
|
|
1
|
+#Arrays - PRMap
|
2
|
2
|
|
3
|
3
|
|
4
|
4
|
|
|
@@ -6,7 +6,7 @@
|
6
|
6
|
![main1.png](images/main1.png)
|
7
|
7
|
![main2.png](images/main2.png)
|
8
|
8
|
|
9
|
|
-
|
|
9
|
+[Verano 2016 - Ive]
|
10
|
10
|
|
11
|
11
|
|
12
|
12
|
Arrays help us to store and work with groups of data of the same type. The data is stored in consecutive memory spaces which can be accessed by using the name of the array and indexes or subscripts that indicate the position where the data is stored. Repetition structures provide us a simple way of accessing the data within an array.
|
|
@@ -138,18 +138,18 @@ In this laboratory experience, you are provided a `GPOI` class with the followin
|
138
|
138
|
---
|
139
|
139
|
|
140
|
140
|
---
|
141
|
|
-
|
142
|
|
-
|
143
|
|
-
|
144
|
|
-!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-01.html"
|
145
|
|
-<br>
|
146
|
|
-
|
147
|
|
-!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-02.html"
|
148
|
|
-<br>
|
149
|
|
-
|
150
|
|
-!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-03.html"
|
151
|
|
-<br>
|
152
|
|
-
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-01.html"
|
|
145
|
+<br>
|
|
146
|
+
|
|
147
|
+!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-02.html"
|
|
148
|
+<br>
|
|
149
|
+
|
|
150
|
+!INCLUDE "../../eip-diagnostic/PRMap/en/diag-prmap-03.html"
|
|
151
|
+<br>
|
|
152
|
+
|
153
|
153
|
---
|
154
|
154
|
|
155
|
155
|
---
|
|
@@ -176,30 +176,22 @@ In this laboratory experience, you are provided a `GPOI` class with the followin
|
176
|
176
|
|
177
|
177
|
2. `int countLinesInFile(ifstream &file)`: Given a reference to the object that represents a file, this function counts and returns the number of lines in the file.
|
178
|
178
|
|
179
|
|
-
|
180
|
179
|
3. `void readFileToArray(ifstream &file, GISPOI A[], int numOfCities)`: Given the `ifstream` object of a file, an array of cities and the number of records to read from the file, this function reads the values from the file and populates the array with objects. **This is a function you will implement.**
|
181
|
180
|
|
182
|
|
-
|
183
|
181
|
4. `void maxDistances(GISPOI A[], int size, int &idxCityA, int &idxCityB)` : Given `A`, an array of cities, determines the farthest two cities. Remember that the distance you will calculate is the *orthodromic* distance. The function returns (by reference) the indices of these cities in the array. **This is a function you will implement.**
|
184
|
182
|
|
185
|
|
-
|
186
|
183
|
5. `void minDistances(GISPOI A[], int size, int &idxCityA, int &idxCityB)`: Given `A`, an array of cities, determines the closest two cities. Remember that the distance you will compute is the *orthodromic* distance. The function returns (by reference) the indices of these cities in the array. **This is a function you will implement.**
|
187
|
184
|
|
188
|
|
-
|
189
|
185
|
6. `double cycleDistance(GISPOI A[], int size, int P[])`: Given an array of cities `A`, the size of the array, and an array `P` with a permutation of the integers in `[0, size-1]`, computes and returns the distance to travel the cycle of cities `A[P[0]]` $$\rightarrow$$ `A[P[1]]` $$\rightarrow \cdots \rightarrow$$ `A[P[size-1]]`. Remember that the distance you will calculate is the *orthodromic* distance.
|
190
|
186
|
|
191
|
|
-
|
192
|
187
|
For example, if the cities read from the file where Mayaguez, Ponce, Yauco and San Juan (in that order) and the permutation `P` is $$(3, 1, 0, 2$$, the function should compute the distance of a cycle from San Juan $$\rightarrow$$ Ponce $$\rightarrow$$ Mayaguez $$\rightarrow$$ Yauco $$\rightarrow$$ San Juan. **This is a function you will implement.**
|
193
|
188
|
|
194
|
189
|
|
195
|
|
-
|
196
|
|
-
|
197
|
190
|
There are two additional functions that you need to know:
|
198
|
191
|
|
199
|
192
|
|
200
|
193
|
1. `void MainWindow::drawLine(const GISPOI &city01, const GISPOI &city02)`: Given a reference to two `GISPOI` objects, the function draws a line between them.
|
201
|
194
|
|
202
|
|
-
|
203
|
195
|
2. `void drawPoints(GISPOI* gisLocations, unsigned int size);`: Given an array of `GISPOI` objects and their size, displays their locations as points in the map.
|
204
|
196
|
|
205
|
197
|
|
|
@@ -272,10 +264,8 @@ Once you have the information of georeferenced cities in the array of objects, y
|
272
|
264
|
|
273
|
265
|
1. Read the documentation and implement the function `double cycleDistance(GISPOI A[], int size, int P[])`. Invoke the function from `main()` as indicated in the comments inside the `main()` function:
|
274
|
266
|
|
275
|
|
-
|
276
|
|
- 1. First with $$P = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9)$$
|
277
|
|
- 2. Then with $$P =(0, 3, 6, 9, 1, 4, 7, 2, 5, 8)$$
|
278
|
|
-
|
|
267
|
+ * First, with $$P = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9)$$
|
|
268
|
+ * Then, with $$P =(0, 3, 6, 9, 1, 4, 7, 2, 5, 8)$$
|
279
|
269
|
|
280
|
270
|
|
281
|
271
|
|
|
@@ -296,7 +286,7 @@ Once you have the information of georeferenced cities in the array of objects, y
|
296
|
286
|
##Deliverables
|
297
|
287
|
|
298
|
288
|
|
299
|
|
-Use "Deliverables" in Moodle to hand in the `main.cpp` file. Remember to use good programming techniques, include the name of the programmers involved, and document your program.
|
|
289
|
+Use "Deliverable" in Moodle to hand in the `main.cpp` file. Remember to use good programming techniques, include the name of the programmers involved, and document your program.
|
300
|
290
|
|
301
|
291
|
|
302
|
292
|
|
|
@@ -310,4 +300,4 @@ Use "Deliverables" in Moodle to hand in the `main.cpp` file. Remember to use goo
|
310
|
300
|
## Referencias
|
311
|
301
|
|
312
|
302
|
|
313
|
|
-[1] https://en.wikipedia.org/wiki/Great-circle_distance
|
|
303
|
+[1] https://en.wikipedia.org/wiki/Great-circle_distance
|