题目内容

请补充函数fun(),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun()。
例如,输入“abcdefghijkl”,输出“cdfhl”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
include <stdio.h>
define N 80
void fun(char s[],int n)
{
int i, j, k, flag;
【 】;
for(i=0; i<n; i++)
{
if (i>1)
s [k++] =s [i];
flag=I;
for(【 】; j<i&&flag; j++)
if (i%j==0)
{
flag=0;
【 】
}
}
s [k]='\0';
}
main()
{
int i=0, strlen=0;
char str[N];
clrscr ();
printf("\n Input a string:\n");
gets (str);
while (str [i] !='\0')
{
strlen++;
i++;
}
fun (str, strlen);
printf("\n*** display string ***\n");
puts (str);
}

查看答案
更多问题

阅读以下说明和JAVA 2代码,填入(n)处。
[说明]
以下JAVA程序设计了类CSet,使用同一个名称(set)的method来传入数据。仔细阅读[代码6-1)、[代码6-2]和[代码6-3]和相关注释,将程序补充完整。
[代码6-1]
import java.io.*;
class CSet
{
private int width;
private int height;
(1)
public void set(String color)
{
col=color; //(a)可输入长方形的颜色
}
public void set (iht w, int h)
{
width=w; //(b)可输入长方形的宽和高
height=h;
}
public void set (String color, int w, int h)
{
col=color; //(c)可输入长方形的颜色、宽和高
width=w;
height=h;
}
public void show ()
{
System.out.println ("n\长方形的颜色为: "+col);
System.out.println ("n\长方形宽为: "+width+" 长方形高为: "+height");
}
}
[代码6-2]
public class hw8_3
{
public static void main (String args[]) throws IOException
{
intw, h; //声明宽、长变量,并给予赋值
String color, k;
CSet rect1;
rect1=new CSet ();
System.out.print ("\n请输入颜色:: ");
color=input ();
System.out.print ("请输入宽度:: ");
k=input ();
w=Integer.parseInt (k);
System.out.print ("请输入高度:: ");
k=input();
h=Integer.parseInt (k);
(2)//设置长方形的颜色
(3)//设置长方形的宽、高
rectl.show ();
(4)//设置长方形的颜色和宽、高
rectl.show ();
}
[代码6-3]
public static String input() throws IOException//输入函数
{
String str;
BufferedReader buf;
(5)
str=buf.readLine ()
return str;
}
}

Ireland became so dependent on it that hundreds of thousands of Irish people starved when

Apache提供了基于用户名/口令的身份认证方式。当系统管理员需要对某个目录设置身份认证时,就在要限制的目录中添加默认名为“(12)”的配置文件。
mod_ssl模块是Apache Web服务器的一个安全模块,它的配置文件是(13)。要载入这个文件而使mod_ss1进程能够工作,必须在/etc/httpd/conf/httpd.conf文件中包括include conf.d/*.conf这条声明。

表达式float(25)/4 int(14.4)%5的值分别为【 】和【 】。

答案查题题库