#include
using namespace std;
void strReplace1(char* strSrc, char* strFind, char*
strReplace)
{
if(strSrc==NULL
||strFind==NULL||strReplace==NULL)
return;
char *replace=strReplace;
char *find = strFind;
while(*strSrc!='\0')
{
if(*strSrc==*strFind)
{
char *begin = strSrc;
while(*strSrc!='\0' &&*strFind!='\0'
&& (*strSrc++==*strFind++));
if(*strFind=='\0')
{
while(*strReplace!='\0' &&
(*begin++=*strReplace++));
strReplace=replace;
}
strFind=find;
}
else
strSrc++;
}
}
int main()
{
char strSrc[]="RSTDEFGRSTKLMNOPQRSTUVWRS";
char strFind[]="RST";
char strReplace[]="ggg";
strReplace1( strSrc, strFind, strReplace );
cout