#include <iostream>
#include <cstdlib>

using namespace std;

void sortiere(string[], int);

int main()
{
	int anzahl = 5;
	string namen[anzahl];
	cout << "Bitte geben Sie 5 Namen ein:" << endl;
	int i = 0;
	for (i = 0; i < 5; i++) 
	{
		cout << "Name " << i+1 << ": ";
		cin >> namen[i];
	}
	cout << "...... AUSGABE IN ALPHABETISCHER REIHENFOLGE ......" << endl;
	sortiere(namen, anzahl);

system("PAUSE");
return 0;
}

void sortiere(string namen[], int size) 
{
	string tmp_name = "";
	for (int i = 0; i < size - 1; i++) 
	{
		for (int j = i+1; j < size; j++) 
		{
			if (namen[i] > namen[j]) {
			tmp_name = namen[i];
			namen[i] = namen[j];
			namen[j] = tmp_name; 
		}
		} 
	}
	
	for (int k = 0; k < size; k++) 
	{
		cout << namen[k] << endl; 
	}
}
