2015年计算机二级考试C语言模拟真题
来源:才华咖 阅读:5.73K 次
一、程序填空题
请补充fun()函数,该函数的功能是:把字符的ASCII 码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输入,其长度作为参数传人fur ()函数。
例如,输入“abcdef”,则输出“bdf”。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include
#define N 100
void【1】
{
int 1,J;
【2】 ;
for(i=0;i if(s[i]%2==0)
s[j++]=s[i];
【3】 ;
}
void main()
{
int i=0,len=0;
char str[N];
printf("please input a string:n");
gets(str);
while(str[i]!=’