Last change
on this file since 95 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
-
Property svn:executable
set to
*
|
File size:
941 bytes
|
Line | |
---|
1 | #include <iostream>
|
---|
2 |
|
---|
3 | using namespace std;
|
---|
4 |
|
---|
5 |
|
---|
6 | int kleinste( const int a[], const int i, const int n ) {
|
---|
7 | int tmpKleinste = i;
|
---|
8 | for(int ctr =(i+1); ctr < n; ctr++ ) {
|
---|
9 | if( a[ctr] < a[tmpKleinste] ) {
|
---|
10 | tmpKleinste = ctr;
|
---|
11 | }
|
---|
12 | }
|
---|
13 | return tmpKleinste;
|
---|
14 | }
|
---|
15 |
|
---|
16 | void verschuif( int a[], const int i, const int j ) {
|
---|
17 | const int tmpGetal = a[j];
|
---|
18 | for(int ctr = j; ctr > i; ctr--) {
|
---|
19 | a[ctr] = a[ctr-1];
|
---|
20 | }
|
---|
21 | a[i] = tmpGetal;
|
---|
22 | }
|
---|
23 |
|
---|
24 | void sorteer( int a[], const int n ) {
|
---|
25 | int tmpKleinste = 0;
|
---|
26 | for(int ctr = 0; ctr < n; ctr++) {
|
---|
27 | tmpKleinste = kleinste( a, ctr, n );
|
---|
28 | cout << "Kleinste = " << tmpKleinste <<endl;
|
---|
29 | verschuif( a ,ctr, tmpKleinste );
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | int const n = 3;
|
---|
34 |
|
---|
35 | void groter( int a[][n], const int X, const int m ) {
|
---|
36 | cout << n;
|
---|
37 | }
|
---|
38 |
|
---|
39 | int main( ) {
|
---|
40 | /* int a[6] = {2,4,1,5,3,6};
|
---|
41 | sorteer( a, 6 );
|
---|
42 | for(int ctr=0; ctr< 6; ctr++) {
|
---|
43 | cout << a[ctr] <<endl;
|
---|
44 | }
|
---|
45 | */
|
---|
46 |
|
---|
47 | int a[3][3] = { { 3, 5, 7 } , { 1, 2, 5 } , { 7, 7, 11} };
|
---|
48 | groter(a, 4, 1);
|
---|
49 |
|
---|
50 | } //end main
|
---|
Note:
See
TracBrowser
for help on using the repository browser.