nikolas_serafini

Lista 4 - Exercício 29

Jun 24th, 2013
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {  
  6.     int i;
  7.     char firstName[50],secondName[50],thirdName[50];
  8.    
  9.     printf("Entre com o primeiro nome :\n");
  10.     gets(firstName);
  11.     printf("Entre com o segundo nome :\n");
  12.     gets(secondName);
  13.     printf("Entre com o terceiro nome :\n");
  14.     gets(thirdName);
  15.  
  16.     if (strcmp(firstName,secondName) < 0 && strcmp(firstName,thirdName) < 0)
  17.         printf("'%s', eh o primeiro, alfabeticamente!\n",firstName);
  18.     else if (strcmp(secondName,firstName) < 0 && strcmp(secondName,thirdName))
  19.         printf("'%s', eh o primeiro, alfabeticamente!\n",secondName);
  20.     else if (strcmp(thirdName,secondName) < 0 && strcmp(thirdName,firstName))
  21.         printf("'%s', eh o primeiro, alfabeticamente!\n",thirdName);
  22.     else
  23.         printf("Os tres nomes sao identicos!\n");
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment