Colección de citas famosas - Slogan de motivación - Lenguaje C, no hay problema al compilar y conectar, ¿por qué no se puede ejecutar?
Lenguaje C, no hay problema al compilar y conectar, ¿por qué no se puede ejecutar?
¿Qué tal esto?
# incluir & ltstdio.h & gt
# incluir & ltstring.h & gt
int main()
{
char a[1000][100], tmp[100];
int i, j, line
//Inicializar matriz 2D de tmp
for(I = 0;i<100;i++)
tmp[I]= ' \ 0 ';
//¡Entra! ! !
I = 0;
Hacer {
get(a[I]);
i++;
} while(strlen(a[I-1])& gt; 0 );
line = I-1; //El último subíndice de la matriz
//Bubbling Sort, el diccionario está ordenado por fila
for(I = 0; i<line;i++)
for(j = 0;j<line-1;j++){
if (strcmp(a[j], a[j+1])& gt; 0){
strcpy(tmp, a[j]);
strcpy(a[ j], a[j+1]);
strcpy(a[j+1], tmp);
}
}
//Salida
for(I = 0;i<line;i++)
printf ("%s\n ", a[ I]);
Devuelve 0;
}