Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdbool.h>
- #include <string.h>
- #include <locale.h>
- #include <windows.h>
- int main()
- {
- char texto[50000];
- int n;
- int i=1;
- char palabra[500];
- printf("Introduce el texto que deseas ordenar alfabeticamente\n");
- gets(texto);
- printf("%s\n", texto);
- for(n=0; n<=texto;n++){
- /*if(texto[n] == ' '){
- printf("Espacio");
- }*/
- if (texto[n] != ' ') {
- palabra[i] = texto[n];
- }
- else{
- i++;
- }
- }
- int j, h, temp[50];
- for(j=0; j<i; j++){
- for(h=h; h<i; h++){
- if(strcmp(palabra[j], palabra[h])>0){
- strcpy(temp, palabra[j]);
- strcpy(palabra[j], palabra[h]);
- strcpy(palabra[h], temp);
- }
- }
- }
- printf("Los nombres ordenados son:\n");
- for(i=0; i<h; i++){
- printf("%s\t", palabra[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement