首页 > 成人高考
题目内容 (请给出正确答案)
[单选题]

以下程序 #include<string.h> main(){ char a1,a2,*s1=a1,*s2=a2; gets(s1);gets(s2) if(!strcmp(s1,s2))printf("*"); else printf("#"); printf("%d",strlen(strcat(s1,s2))); } 如果从键盘上输入: book<回车> book<空格><回车> 则输出结果是

A.*8

B.#9

C.#6

D.*9

答案
收藏

B、#9

如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“以下程序 #include<string.h> main()…”相关的问题
第1题
有以下程序#include<stdio.h>#include<string.h>main(){char x[]=“STRING”;x[0]=0;

有以下程序

#include<stdio.h>

#include<string.h>

main()

{char x[]=“STRING”;

x[0]=0;x[1]=’\0’;x[2]=’0’;

printf(”%d%d\n”,sizeof(x),strlen(x));

}

程序运行后的输出结果是()。

A.6 1

B.7 0

C.6 3

D.7 1

点击查看答案
第2题
给定以下程序段insert code public class foo {public static void main (String[] args) throws

给定以下程序段

insert code public class foo {

public static void main (String[] args) throws Exception {

printWriter ut = new PrintWriter (new java.io.outputStreamWriter (System.out), true) ;

out.printIn(“Hello”);

}

}

要使程序能正确运行,在insert code处必须添加()语句。

A、import java.io.PrintWriter;

B、include java.io.PrintWriter;

C、import java.io.OutputStreamWriter;

D、include java.io.OutputStreamWriter;

点击查看答案
第3题
下列给定程序中函数fun()的功能是:求出字符串中最后一次出现的子字符串的地址,通过函数值返回,在

下列给定程序中函数fun()的功能是:求出字符串中最后一次出现的子字符串的地址,通过函数值返回,在主函数中输出从此地址开始的字符串;若未找到,则函数值为NULL。例如,当字符串中的内容为abcdabfabcdx,t中的内容为ab时,输出结果应是abcdx。当字符串中的内容为abcdabfabcdx,t中的内容为abd时,则程序输出未找到的信息:Not found!

请改正程序中的错误,使它能得出正确的结果。

注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。

试题程序:

include<stdio.h>

include <conio.h>

include <string.h>

char *fun(char *s,char *t)

{

char *p,*r,*a;

/*************found**************/

a=Null;

while(*s)

{ p=s;r=t;

while(*r)

/*************found**************/

if(r= =p) {r++;p++;}

else break;

if(*r=='\0') a=s;

s++;

}

return a;

}

main()

{char s[100],t[100],,*p;

clrscr();

printf("\nPlease enter string S: ");

scanf("%s",s);

printf("\nPlease enter substring t: ");

scanf("%s",t);

p=fun(S,t);

if(p) printf("\nThe result is:%s\n",p);

else printf("\nNot found!\n ");

}

点击查看答案
第4题
请编写函数fun(),其功能是:将s所指字符串中下标为偶数的字符删除,串中剩余字符形成的新串放在t所

请编写函数fun(),其功能是:将s所指字符串中下标为偶数的字符删除,串中剩余字符形成的新串放在t所指数组中。

例如,当s所指字符串中的内容为ABCDEFGHIJK,则在t所指数组中的内容应是BDFHJ。

注意:部分源程序给出如下。

请勿改动主函数main口其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。

试题程序:

include<conio. h>

include<stdio .h>

include<string.h>

void fun(char *s,char t[])

{

}

main ()

char s[l00] ,t[l00];

clrscr ();

printf("%nPlease enter string S: ");

scanf("%s ",s);

fun(s,t);

prlntf("\nThe result is:%s\n ",t);

}

点击查看答案
第5题
#include<stdio.h>是下面哪个函数的头文件()

A.].printf

B.].string

C.].strcpy

D.].open

点击查看答案
第6题
以下作为之Java程序入口main()方法正确的写法是

A.public void main(String args[]){}

B.public int main(String args[]){}

C.public static void main(String args[]){}

D.public static int main(String args[]){}

点击查看答案
第7题
有以下程序()

A.#include

B.02356

C.0235

D.235

E.2356

点击查看答案
第8题
给出以下代码,该程序的运行结果是()class Example {public static void main (String args[])

A.-1

B.Exception

C.1

D.0

点击查看答案
第9题
以下程序的运行结果为()public class IfTest{public static void main(String args[]){int x=3;

A.Not equal

B.Equal

C.无输出

D.编译出错

点击查看答案
第10题
有以下程序()

A.#include

B.x=4

C.x=8

D.x=6

E.x=12

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改