Guest User

Untitled

a guest
Jan 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main()
  7. {
  8.   char word1[20];
  9.   char word2[20];
  10.  
  11.   printf("\n first word:\n1: ");
  12.   scanf("%s", word1);                                 /* Read the first word    */
  13.  
  14.   printf(" second word:\n 2: ");
  15.   scanf("%s", word2);                                 /* Read the second word   */
  16.  
  17.   /* Compare the two words */
  18.   if(strcmp(word1,word2) == 0)
  19.     printf("identical words");
  20.   else
  21.     printf("%s comes before %s", (strcmp(word1, word2) > 0) ? word2 : word1, (strcmp(word1, word2) < 0) ? word2 : word1);
  22. }
  23.  
  24.  
  25.  
  26.            
  27.        
Add Comment
Please, Sign In to add comment