1,实例代码:
#include<iostream>
using namespace std;
char hashTable[256];
void initHash(const char * b)
{
while(*b!='\0')
hashTable[*b++] = 1; //下标对应字符的ascii码。
}
void ProcessTheString(char * a)
{
char * pFast;
char * pSlow;
pFast = pSlow = a; //实在是太nb了.
while (*pFast!='\0')
{
if(!hashTable[*pFast])
*pSlow++ = *pFast++;
else
pFast++;
}
*pSlow = '\0';
}
int main()
{
char a[] = "They are Students.";
char b[] = "aeiou";
initHash(b);
ProcessTheString(a);
printf("%s", a);
return 0;
}