重要提示:请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
首页 > 成人高考
网友您好,请在下方输入框内输入要搜索的题目:
搜题
拍照、语音搜题,请扫码下载APP
扫一扫 下载APP
题目内容 (请给出正确答案)
[单选题]

以下程序 #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

更多“以下程序 #include<string.h> main(){ char a1,a2,*s1=a1,*s2=a2; gets(s1);gets(s2) if(!strcmp(s1,s2))printf…”相关的问题

第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

点击查看答案
下载APP
关注公众号
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案 购买前请仔细阅读《购买须知》
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《服务协议》《购买须知》
立即支付 系统将自动为您注册账号
已付款,但不能查看答案,请点这里登录即可>>>
请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
请用微信扫码测试
优题宝