C++实现指定的字符串替代(华为)

#include<iostream>#include<cstring>#include<string>#include<cstdlib>using namespace std;/*void replace(char *str_src,char *str_find,char *str_replace){if(NULL==str_src||str_find==NULL||str_replace==NULL)return ;char *head=str_src;int length1=strlen(str_find);int length2=strlen(str_replace);while(*str_src!='\0'){if(*str_src==*str_find){if(strncmp(str_src,str_find,length1)==0){for(int i=0;i<length2;++i){*str_src=*(str_replace+i);str_src++;}}else{str_src++;}}else{str_src++;}}str_src=head;}int main(){char a[]="";char b[]="ggg";char c[]="zzz";replace(a,b,c);cout<<a<<endl;system("pause");return 0;}*/

,比谁都感激这份“不能说出的爱”。

C++实现指定的字符串替代(华为)

相关文章:

你感兴趣的文章:

标签云: