Регистрация | Вход
int strcmp(char* s1, char* s2, int len){ for (int i = 0; i < len; ++i) if (s1[i] != s2[i]) return 1; return 0;}
#include <stdio.h>#include <string.h>int scmp(char* s1, char* s2, int len){ printf("%s\n",s1); for (int i = 0; i < len; ++i) if (s1[i] != s2[i]) return 1; return 0;}int contain(char* s1, char* s2, int len1, int len2){ for (int i = 0; i <= len1 - len2; ++i) if (scmp(s1 + i, s2, len2) == 0) return 0; return 1;}void main(){ char s1[] = "aaa bbb ccc"; char s2[] = "bbb"; int len1 = strlen(s1); int len2 = strlen(s2); printf("contain %i", contain(s1,s2, len1, len2)); }
int scmp(char* s1, char* s2, int len){ printf("%s\n",s1); for (int i = 0; i < len; ++i) if (s1[i] != s2[i]) return 1; return 0;}int contain(char* s1, char* s2, int len1, int len2){ for (int i = 0; i <= len1 - len2; ++i) if (scmp(s1 + i, s2, len2) == 0) return 0; return 1;}