如何编写用户定义的函数来搜索并用字符串替换另一个字符串中包含的任何字符的字符出现。不能在代码中使用任何字符串变量,必须是用户定义的函数。谢谢这是我迄今为止尝试过的#define _CRT_SECURE_NO_WARNINGS #include #include
void s1();
void s2();
int main(void)
{
int i=0;
s1();
s2();
printf("c = {'$'} ");
}//main
void s1(){
int i = 0;
while (i <= 40){
printf("%c", (rand() % 25) + 'A');
i++;
}
}
void s2(){
char s2[20];
printf("\nEnter a string of minimum 2 and maximum 20 characters= ");
gets(s2);
puts(s2);
}
/* 我只需要创建另一个函数来搜索 s1 并用可以是任何字符的字符(例如“$”)替换任何出现的包含 s2 的任何字符
*/