Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  6.  
  7. int main(int argc, char *argv[]) {
  8. char wyraz1[20];
  9. char wyraz2[20];
  10. puts("podaj slowo");
  11. gets(wyraz1);
  12. puts("podaj drugie slowo");
  13. gets(wyraz2);
  14. printf("Pierwsze slowo sklada sie z %i znakow\n", strlen(wyraz1));
  15. printf("Drugie slowo sklada sie z %i znakow\n",strlen(wyraz2));
  16. if(strcmp(wyraz1,wyraz2)>0) printf("Pierwsze slowo jest dluzsze");
  17. if(strcmp(wyraz1,wyraz2)<0) printf("Drugie slowo jest dluzsze");
  18. if(strcmp(wyraz1,wyraz2)==0) printf("Slowa takiej samej dlugosci");
  19. int b = strcmp(wyraz1,wyraz2);
  20. printf("\n%i",b);
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement