當前位置:才華齋>計算機>計算機二級>

2015年計算機二級考試C語言模擬真題

計算機二級 閲讀(6.13K)

  一、程序填空題

2015年計算機二級考試C語言模擬真題

請補充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]!=’