Advertisement
Guest User

asdad

a guest
May 23rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. char nome[5][50];
  2. char nomeTemp[5][50];
  3. int i,j;
  4.  
  5. printf("Digite 5 nomes\n");
  6.  
  7. for(i=0;i<5;i++){
  8. gets(nome[i]);
  9. }
  10.  
  11. for(i=0;i<5;i++){
  12. for(j=i+1;j<5;j++){
  13. if(strcmp(nome[i],nome[j])>0){
  14. strcpy(nomeTemp, nome[i]);
  15. strcpy(nome[i], nome[j]);
  16. strcpy(nome[j], nomeTemp);
  17. }
  18. }
  19. }
  20.  
  21. for(i=0;i<5;i++){
  22. printf("Nome= %s\n", nome[i]);
  23. }
  24.  
  25. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement