|
@@ -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,19 +176,14 @@ 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
|
|
|
@@ -272,9 +267,8 @@ Once you have the information of georeferenced cities in the array of objects, y
|
272
|
267
|
|
273
|
268
|
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
|
269
|
|
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)$$
|
|
270
|
+ * First, with $$P = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9)$$
|
|
271
|
+ * Then, with $$P =(0, 3, 6, 9, 1, 4, 7, 2, 5, 8)$$
|
278
|
272
|
|
279
|
273
|
|
280
|
274
|
|
|
@@ -296,7 +290,7 @@ Once you have the information of georeferenced cities in the array of objects, y
|
296
|
290
|
##Deliverables
|
297
|
291
|
|
298
|
292
|
|
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.
|
|
293
|
+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
|
294
|
|
301
|
295
|
|
302
|
296
|
|
|
@@ -310,4 +304,4 @@ Use "Deliverables" in Moodle to hand in the `main.cpp` file. Remember to use goo
|
310
|
304
|
## Referencias
|
311
|
305
|
|
312
|
306
|
|
313
|
|
-[1] https://en.wikipedia.org/wiki/Great-circle_distance
|
|
307
|
+[1] https://en.wikipedia.org/wiki/Great-circle_distance
|