Advertisement
MAT4m

Untitled

Jan 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. struct Boo
  5. {
  6. char title[50];
  7. char author[50];
  8. int id
  9. };
  10.  
  11.  
  12. int main()
  13. {
  14. int result;
  15. struct Boo Book1;
  16. struct Boo Book2;
  17.  
  18. strcpy(Book1.title, "AAA");
  19. strcpy(Book1.author, "TS");
  20. Book1.id = 45464;
  21.  
  22. strcpy(Book2.title, "BBAA");
  23. strcpy(Book2.author, "MW");
  24. Book2.id = 457774;
  25.  
  26. printf("Book 1 : T: %s A: %s ID: %d", Book1.title,Book1.author,Book1.id);
  27.  
  28. result = strcmp(Book1.title,Book2.title);
  29.  
  30. if (result == 0) printf("Strings are the same\n");
  31.  
  32. if (result < 0) printf("Second string is less than the first\n");
  33.  
  34. if (result > 0) printf("First string is less than the second\n");
  35. return 0;
  36.  
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement