SHARE
TWEET

asdad

a guest May 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top