#include <iostream>
using namespace std;

// globale Definitionen
const int MAXLEN = 10;

// Prototyp
void selectionSort(int *pf, int len);

// Hauptprogrammfunktion
int main()
{
	// benötigte Variablen
	int feld[MAXLEN];

	// Werte vom Nutzer einlesen
	cout << "\nGeben Sie " << MAXLEN << " Zahlen getrennt von Leerzeichen ein: ";
	for(int i=0; i< MAXLEN; i++)
	{
		cin >> feld[i];
	}

	// Sortierfunktion aufrufen
	selectionSort(feld,MAXLEN);

	// Ausgabe	
	cout << "\nDas aufwärts sortierte Feld:";
	for(int i=0; i< MAXLEN; i++)
	{
		cout << " " << feld[i];
	}
	cout << endl;

	return 0;
}

// Funktionsdefinition
void selectionSort(int *pf, int len)
{
	for(int i=0; i<len-1; i++)
		for(int j=i+1; j<len; j++)
		{
			if(*(pf+i) > *(pf+j))
			{
				// tausche
				int tmp = *(pf+i);
				*(pf+i) = *(pf+j);
				*(pf+j) = tmp;
			}
		}
}
