Advertisement
weldisalves

Lista 04 - exercício 28

Jun 21st, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1.  
  2.  
  3.     #include <stdio.h>
  4.     #include <string.h>
  5.     #define MAX 1000
  6.      //28. Solicite dois nomes ao usuário, em seguida coloque-os em ordem alfabética.
  7.  
  8.     int main()
  9.     {
  10.         char nome1[MAX],nome2[MAX];
  11.  
  12.         printf("\n Digite dois nomes: \n");
  13.  
  14.         fgets(nome1,MAX,stdin);
  15.         fgets(nome2,MAX,stdin);
  16.  
  17.         if(strcmp(nome1,nome2)<0)
  18.         {
  19.             printf("\n %s %s",nome1,nome2);
  20.         }else{
  21.             printf("\n %s %s",nome2,nome1);
  22.             }
  23.  
  24.         getchar();
  25.         return 0;
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement