Go to file
2024-12-06 14:23:52 +04:00
.gitignore Initial commit 2024-12-06 14:21:04 +04:00
README.md Обновить README.md 2024-12-06 14:23:52 +04:00

Spring-Boo-BackEnd

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include #include #include <string.h> #include <windows.h> int strlen(char s[]) { char* p = s; while (*p++); return p - s - 1;

} int strcpy(char s[]) { char* p = s; while (p++); return p - s - 1; } int strcat(char s[]) { char p = s; while (*p++); return p - s - 1; } int strcmp(char s[], char d[]) { /char p = s; while (p++); return p - s - 1;/ return 0; } int strspn(char s[], char d[], char f[]) { return 0; } int main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); //1: /char s[10] = "HI"; printf("len = %d\n", strlen(s)); s[2] = ' '; s[3] = '\0'; printf("len = %d\n", strlen(s)); s[3] = 'w'; s[4] = 'o'; s[5] = 'r'; s[6] = 'l'; s[7] = 'd'; s[8] = '\0'; printf("len = %d\n", strlen(s));/

//2:
/*char s[] = "buttom";
char dest[] = "no buttom";
printf("s = %s, dest = %s\n", s, dest);
strcpy(dest, s);
printf("s = %s, dest = %s\n", s, dest);*/

//3:
/*char s[100] = "buttom";
char d[100] = "!!!!";
printf("s = %s, d = %s\n", s, d);
strcat(s, d);
printf("s = %s, d = %s\n", s, d);
strcat(s, "     ");
printf("s = %s, d = %s", s, d);*/

//4:
/*int o = 0, i = 0;
char s[] = "strcmp";
char d[] = "strcat";
for (int o = 0; s[o] != '\0' && d[o] != '\0'; o++) {
	if (s[o] == d[o]) i++;
}
printf("s = %s, d = %s, f = %s\ni = %d", s, d, i);*/

//5:
char s[] = "strcmp";
char d[] = "str0py";
char f[] = "t00";
int n1 = strspn(s, f);
int n2 = strspn(f, d);
int n = strspn(s, d);
int min = n;
min = (min < n1) ? min : n1;
min = (min < n2) ? min : n2;
printf("n = %d", min);





return 0;

}