#include <iostream> #include <stdlib.h> using namespace std; int main() { char f[] = "ac"; char s[] = "abcxabczabc"; void squeeze(char*, char*); squeeze(s, f); cout << s << endl; system("pause"); return 0; } void squeeze(char *s,char *f) { char *tails, *pf, *s1, *s2; for (tails = s; tails != '\0'; tails++); for (pf = f; pf != '\0'; pf++) { for (s1 = s; s1 <= tails - 1; s1++) if (pf == s1) { for (s2 = s1; s2 <= tails - 1; s2++) *s2 = *(s2 + 1); tails--; } } }
天狗
相关分类