• Keine Ergebnisse gefunden

„C++ / GUI “ Exercise 17 vectors

N/A
N/A
Protected

Academic year: 2021

Aktie "„C++ / GUI “ Exercise 17 vectors"

Copied!
1
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

„C++ / GUI “ Exercise 17

vectors

C++ provides a new class vector. You can use it like traditional arrays in C. Some Documentation resides at http://www.cplusplus.com/reference/. In this task you will do some sorting and statistics.

1. Generate a vector of about 10 elements. Choose an element type (e.g. int). The elements can be unsorted.

2. Try to access illegal indices using [] and at(int).

3. Define a function int sorted( Type one, Type two ), which returns 1 if num- ber one is less or equal than number two and 0 otherwise.

4. Write a function to swap two elements of a vector.

5. Write a function to sort two elements of a vector. Use sorted and swap. 6. Write a function to calculate the average of a vector.

7. Write a function to find the smallest element of a vector. Use sorted. 8. Write a function to sort a vector.

9. If not already done, turn sorted into a template function.

Have fun!

1

Referenzen

ÄHNLICHE DOKUMENTE

Moreover, we characterize the victory domains by means of geometrical condi- tions (it is the discriminating kernel of a closed set).. This characterization is used

2015 IT IS 3 MINUTES TO MIDNIGHT Unchecked climate change, global nuclear weapons modernizations, and outsized nuclear weapons arsenals pose extraordinary and undeniable threats

In general, titanium(IV) complexes are known to be reactive compounds, which might degenerate the ligand itself. For this purpose, divalent 3d transitions metals were chosen.

o Provincial/Territorial: Deena Hinshaw - The chief medical officer of Alberta, British Columbia Ministry of Health, Brent Roussin - The chief medical officer of Manitoba,

(Quelle: Landesinstitut für Schulqualität und Lehrerbildung Sachsen-Anhalt (LISA), Niveaubestimmende Aufgaben zum Lehrplan Sekundarschule Englisch)... Why has each letter

In order to check the validity of the analytic results from the 1/D expansion above for the most realistic case of D = 3, we performed Monte Carlo simulation for three-

Commensurability oscillations 12,13 in the low-field mag- netoresistance of a 2DEG reflect ballistic transport in the lateral superlattice and can be employed to map out the exact

For the second stage estimates we implemented a standard generalized least squares (GLS) random-effects panel estimator, a similar two stage IV estimator in which we include the