Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char nombre[3][20];
- char aux[20];
- int i, j;
- for(i=0; i<3; i++)
- {
- printf("Introduce nombre %d : ", i+1);
- fflush(stdin);
- gets(nombre[i]);
- }
- for(i=0; i<2; i++)
- for(j=i+1; j<3; j++)
- if(strcmp(nombre[i], nombre[j]) > 0)
- {
- strcpy(aux, nombre[i]);
- strcpy(nombre[i], nombre[j]);
- strcpy(nombre[j], aux);
- }
- for(i=0; i<3; i++)
- printf("\n %s\n", nombre[i]);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement