// BURBUJA ... ALGORITMO DE ORDENAMIENTO
#include <stdio.h>
#include <string.h>
struct Datos { char cad[20]; };
void IntroduceDatos(struct Datos VC[10])
{
int indice = 0;
for(indice = 0; indice<10; indice++)
{
printf("Introduce una cadena: ");
scanf("%s", VC[indice].cad);
}
}
void Ordena(struct Datos VC[10])
{
int x,y;
char AUX[20];
for(x = 0; x < 10; x++)
for(y = 0; y < 10; y++)
{
if ( strcmp(VC[x].cad, VC[y].cad) < 0 )
{
strcpy(AUX, VC[x].cad);
strcpy(VC[x].cad, VC[y].cad);
strcpy(VC[y].cad, AUX);
}
}
}
main()
{
int x=0;
struct Datos VectorCad[10];
IntroduceDatos(VectorCad);
for(x=0; x<10; x++) printf("%s\n", VectorCad[x].cad);
Ordena(VectorCad);
for(x=0; x<10; x++) printf("%s\n", VectorCad[x].cad);
}