Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- int kol(char *mas1, char *mas2, int n, int flag);
- void zap(char *mas1, char *mas2, char *mas3, int n, int flag);
- void vivod(char *mas, int a);
- int main()
- {
- char S1[100];
- char S2[100];
- gets_s(S1);
- gets_s(S2);
- int z = strlen(S1);
- int y = strlen(S2);
- int x = kol(S1, S2, z, y);
- char *S3 = (char*)malloc(x * sizeof(char));
- zap(S1, S2, S3, z, y);
- vivod(S3, x);
- system("pause");
- return 0;
- }
- int kol(char *mas1, char *mas2, int n, int flag)
- {
- int s = 0, k = 0;
- for (int i = 0; i < n; i++)
- {
- k = 0;
- for (int j = 0; j < flag; j++)
- if (mas1[i] != mas2[j])
- k++;
- if (k == flag)
- s++;
- }
- return s;
- }
- void zap(char *mas1, char *mas2, char *mas3, int n, int flag)
- {
- int s = 0, k = 0;
- for (int i = 0; i < n; i++)
- {
- k = 0;
- for (int j = 0; j < flag; j++)
- if (mas1[i] != mas2[j])
- k++;
- if (k == flag)
- {
- mas3[s] = mas1[i];
- s++;
- }
- }
- }
- void vivod(char *mas, int a)
- {
- for (int i = 0; i < a; i++)
- printf("%c ", mas[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement