编写函数fun,其功能是:从字符串中删除指定的字符。同字母的大、小写按不同字符处理。
例如,若程序执行时输入字符串为:
"turbo C and borland c++"
从键盘上输入字符n,则输出为:
"turbo c ad borlad c++"
如果输入的字符在字符串中不存在,则字符串照原样输出。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include<stdio.h>
void fun(char s[],int c)
main()
static char str[]="turbo c and borland c++";
char oh;
printf("原始字符串:%s\n",str);
printf("输入一个字符:\n");
scanf("%c",&ch);
fun(str,ch);
printf("str[]=%sin",str);
strcpy(str,"turbo c and borland c++");
fun(str,’a’);