填空题
给定程序的功能是:判断字符ch是否与串str中的某个字符相同,若相同什么也不做,若不同则插在串的最后。
注意:部分源程序给出如下。
请勿改动函数main()和其他函数中的任何内容,仅在标号处填入所编写的若干表达式或语句。
试题程序
#include
<stdio.h>
#include <string.h>
void fun(char *
str, char ch)
{ while(* str && * str!=ch)
str ++;
if(*str != ch) {
str[0]=ch;
str[1]=0;
}
}
main()
{ char s[81], c;
printf("/nPlease enter a string:/n");
gets(s);
printf("/n Please enter the character to search:");
c=______;
fun(s, c);
printf("/nThe result is %
s/n", s);
}