#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--;
}
}
}就是这么个样子。
- 2 回答
- 0 关注
- 1392 浏览
添加回答
举报
0/150
提交
取消