#include <iostream>
#include <cstdlib>

using namespace std;
void sortieren(string *namen, int size);
int main(int argc, char *argv[])
{
    string namen[5];
    cout << "Bitte geben Sie 5 Namen ein:" << endl;
    for (int i = 0; i < 5; i++)
    {
        cout << "Name " << i + 1 << ": ";
        cin >> namen[i];
    }
    sortieren(namen, 5);
    for(string name:namen)
        cout<<name<<endl;
    system("PAUSE");
    return 0;
}

void sortieren(string *namen, int size)
{
    for (int i = 0; i < size - 1; i++)
    {
        for (int j = i + 1; j < size; j++)
            if (namen[i] > namen[j])
            {
                string tempName = namen[i];
                namen[i] = namen[j];
                namen[j] = tempName;
            }
    }
}