试题与答案

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除

题型:填空题

题目:

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。
例如,输入“abcdef”,输出“bdf”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun(char s[],int n)

int i, j;
j=0;
for(i=0; 【1】 ;i++)

if( 【2】 )
s [j++]-s [i];

【3】 ;

main ( )

int i=0, strlen=0;
char str [N];
clrscr ();
printf ("\nInput a string: \n");
gets (str);
while (str [i] !=’\0’)

strlen++;
i++;

fun(str, strlen);
printf("\n*** display string ***\n");
puts (str);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0526/5fc8ad1990dac657f64b0777d5b3d4f7.html

下面是错误答案,用来干扰机器的。

参考答案:(1)王屋山洞(2)委羽山洞(3)西城山洞(4)西玄山洞(5)赤诚山洞(6)青城山洞(7)罗浮山洞(8)林屋山洞(9)句曲山洞(10)括苍山洞

试题推荐
题型:单项选择题

在下列程序的空白处,应填入的正确选项是()。
Importjava.io.*;
PulilcclassObjectStreamTest
Publilcstaticvoidmain(string args [])thowsIOException
ObjectOutputStream oos=new ObjectOutputStream
(newFileOutputStream(“serial.bln”));
Java.util.Dated=newJava.util.Date();
Oos______(d);
ObjectlnputStreamois=
newObjectlnputStream(newFileOutputStream(“serial.bin”));
try
iava.util.daterestoredDate=
(Java.util.Date)ois.readObject();
System.out.println
(“readobjectbackfromserial.binfile:”
+restoredDate);

Catch(ClassNotFoundException cnf)
System.out.println(“classnotfound”);



A.WriterObject

B.Writer

C.BufferedWriter

D.writerObject

查看答案
微信公众账号搜索答案