首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列给定程序中,函数fun的功能是:先将s所指字符串中的字符按逆序存放到t所指字符串中,然后把s所指串中的字符按正序连接到t所指串之后。 例如,当s所指的字符串为“ABCDE”时,t所指的字符串应为“EDCBAABCDE”。 请改正程序中的
下列给定程序中,函数fun的功能是:先将s所指字符串中的字符按逆序存放到t所指字符串中,然后把s所指串中的字符按正序连接到t所指串之后。 例如,当s所指的字符串为“ABCDE”时,t所指的字符串应为“EDCBAABCDE”。 请改正程序中的
admin
2017-09-23
21
问题
下列给定程序中,函数fun的功能是:先将s所指字符串中的字符按逆序存放到t所指字符串中,然后把s所指串中的字符按正序连接到t所指串之后。
例如,当s所指的字符串为“ABCDE”时,t所指的字符串应为“EDCBAABCDE”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include < stdlib.h >
#include < conio.h >
#include < stdio.h >
#include < string.h >
void fun(char*s,char*t)
{
/*********found*********/
int i;
s1=str1en(s);
for(i=0;i < s1;i++)
/*********found*********/
t
=s[s1一i];
for(i=0 ; i < =s1 ; i++)
t[s1+i]=s
;
t[2*s1]=’\0’;
}
void main()
{
char s[1 00],t[1 00];
system("CLS");
printf("\n Please enter
string s:");
scanf("%s",s);
fun(S,t);
printf ("The result is:%s\n",t);
}
选项
答案
(1)int i,s1; (2)t[i] =s[s1一i一1];
解析
(1)变量s1没有定义。
(2)该循环实现将s串中的字符逆序存入t串中,t
对应s串中的s[s1一i一1]。
转载请注明原文地址:https://jikaoti.com/ti/lTa0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列叙述中错误的是()。
下面程序的功能是:计算1~20之间的奇数之和与偶数之和,请填空使程序功能完整。#include<stdio.h>main(){inta=0,b=0,c=0,i;for(i=0;i<=20;i+=2){a+=
以下叙述中错误的是()。
若有语句doublex=17;inty;,当执行y=(int)(x/5)%2;之后y的值为()。
以下程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空:#include<stdio.h>#defineN3typedefstruct{in
“printf("%d\n",strlen("\t\"\023\xAB\nC"));”语句的输出结果是()。
在关系数据库中,把数据表示成二维表,每一个二维表称为()。
在下列模式中,能够给出数据库物理存储结构与物理存取方法的是
C语言中规定,程序中各函数之间()。
以下标识符不是关键字的是()。
随机试题
慢性特发性血小板减少性紫癜首选的治疗措施是()
患者,女,65岁。每年持续咳嗽约4个月,已连续8年,胸部X片示两肺纹理增粗、紊乱。近日来咳嗽加剧,气促,痰多色黄黏稠,面红咽干,渴喜冷饮,便秘,尿赤,舌苔黄腻,脉滑数。应首先考虑的诊断是()
补肾壮阳,又祛风除湿宜选
目前,职工个人只可以到管理中心或商业银行查询个人住房公积金缴存情况,不可以通过住房公积金磁卡、电话、网络系统查询。()
根据建标[2003]206号文件,建筑材料的采购费、仓储费、工地保管费和仓储损耗费、属于建筑安装工程的()。
下列关于超额备付金率的叙述中,正确的有()。
企业拥有的一项经济资源,即使没有发生实际成本或发生的实际成本很小,但如果公允价值能够可靠计量,也应认为符合资产能够可靠计量的确认条件。()
《中华人民共和国反外国制载法》于2021年6月10日起施行。这是一部指向性、针对性颇强的专门法律,共有16条,这部法律主要针对的是()。
下列选项中,()不属于人员配备管理计划的内容。
以下关于面向对象软件测试的说法中,正确的是
最新回复
(
0
)