C程序设计语言,练习2-4
测试结果与代码如下,有bug欢迎指正!
代码:
#include <stdio.h>void squeeze(char s1[],char s2[]);int main(){char s1[100],s2[100];printf(\"输入字符串1:\");scanf_s(\"%s\",s1,100);printf(\"输入字符串2:\");scanf_s(\"%s\",s2,100);squeeze(s1,s2);printf(\"%s\\n\",s1);return 0;}void squeeze(char s1[],char s2[]){int i,j,m;for(m = 0; s2[m] != \'\\0\'; m++){for(i = j = 0; s1[i] != \'\\0\'; i++){if(s1[i] != s2[m])s1[j++] = s1[i];}s1[j] = \'\\0\';}}```