Hi,
das müßte in C so aussehen:
#include <iostream.h>
#include <stdio.h>
#include <string.h>
void main(void)
{
char woerter[5][50];
char wort[50];
for(int i=0;i<5;i++)
{
cout<<"Geben Sie ein Wort ein: ";
gets(wort);
strcpy(woerter,wort);
cout<<endl;
}
for(i=0;i<5;i++)
{
for(int j=i+1;j<5;j++)
{
if(strcmp(woerter,woerter[j])>0)
{
strcpy(wort,woerter);
strcpy(woerter,woerter[j]); strcpy(woerter[j],wort);
}
}
}
for(i=0;i<5;i++)
cout<<woerter<<endl;
}
Wenn du anders herum sortieren willst, dann ersetzte das >0 durch <0
Ciao
[Dieser Beitrag wurde von DrGreg am 20. Dezember 2000 editiert.]