首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列给定程序中,函数fun的功能是:先将s所指字符串中的字符按逆序存放到t所指字符串中,然后把s所指串中的字符按正序连接到t所指串之后。 例如,当s所指的字符串为“ABCDE”时,t所指的字符串应为“EDCBAABCDE”。 请改正程序中的
下列给定程序中,函数fun的功能是:先将s所指字符串中的字符按逆序存放到t所指字符串中,然后把s所指串中的字符按正序连接到t所指串之后。 例如,当s所指的字符串为“ABCDE”时,t所指的字符串应为“EDCBAABCDE”。 请改正程序中的
admin
2017-09-23
19
问题
下列给定程序中,函数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://kaotiyun.com/show/yoxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下叙述错误的是()。
当数据的物理结构(存储结构、存取方式等)改变时,不影响数据库的逻辑结构,从而不致引起应用程序的变化,这是指数据的()。
程序设计的任务包括()。
下列选项中,不属于数据模型所描述的内容的是()。
下面程序的运行结果是()。#include<stdio.h>main(){inta=25;fun(&A);}fun(int*x){printf("%d\n",++*x);}
以下能正确定义且赋初值的语句是()。
将E-R图转换到关系模式时,实体与联系都可以表示成()。
若有代数式(其中e仅代表自然对数的底数,不是变量),则以下能够正确表示该代数式的C语言表达式是()。
在关系数据库中,把数据表示成二维表,每一个二维表称为()。
设有说明int(*ptr)[M];其中的标识符ptr是()。
随机试题
虚劳虚烦不得眠,心悸盗汗,头目眩晕,舌干口燥,脉细弦者,治宜选用()(1996年第49题)
与遣精关系最密切的两个脏是
不属于山楂的炮制规格是
四物汤的主治病证是()
根据业务活动,外汇敞口大致可以分为交易性外汇敞口和()
某公司存货周转期为160天,应收账款周转期为90天,应付账款周转期为100天,则该公司现金周转期为()天。(2014年)
成熟企业可以采取的营销策略有()。
自带来诸多社会矛盾且已“污名化”后,近年来暂住证制度在各地已陆续废除。打上了“服务”标签的“居住证”制度成为社会管理上的一种“制度创新”。在很多城市,它对流动人口作出了融人城市社会的承诺。然而,其根本缺陷就是门槛极高,且仍延续对“本地人”、“外地人”的身份
A、 B、 C、 B
A、In1585.B、In1584.C、In1583.D、In1586.C综合推断题。根据文中的...attheageofeighteenhemarriedagirl...whogavehimachildthef
最新回复
(
0
)