算法训练——字符删除
//字符删除 #include<stdio.h> #include<String.h> int main(){ char str[20],str2[20]; char ch; int length,i,j = 0; scanf("%s\n",&str); scanf("%c",&ch); length = strlen(str); for(i=0;i<length;i++){ if(str[i] != ch){ str2[j] = str[i]; printf("%c",str2[j]); j++; } else continue; } return 0; }