Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. int search(char *srt1, char *str2);
  3.  
  4. int main()
  5. {
  6. char str1[12] = { "abcdefghigk" };
  7. char str2[7] = { "abcdef" };
  8. printf("%d\n", search(str1, str2, k));
  9. getchar();
  10. return 0;
  11. }
  12.  
  13. int search(char *str1, char *str2)
  14. {
  15. int minus = 0;
  16. for (int i = 0; i < 11; i++)
  17. {
  18. k++;
  19. for (int j = 0; j < 6; j++)
  20. {
  21. if (str1[i] - '0' == str2[j] - '0')
  22. {
  23. minus = 1;
  24. }
  25. k = k - minus;
  26. minus = 0;
  27. }
  28. }
  29. return k;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement