首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序的运行结果是【 】。 #include<iostream> #include<string> using namespace std; void main(){ chara[10]="China",b[]="
以下程序的运行结果是【 】。 #include<iostream> #include<string> using namespace std; void main(){ chara[10]="China",b[]="
admin
2013-02-27
22
问题
以下程序的运行结果是【 】。
#include<iostream>
#include<string>
using namespace std;
void main(){
chara[10]="China",b[]="Chin",c[]="ese";
cout<<strlen(strcat(strcpy(a,b),c))<<endl;
}
选项
答案
7
解析
本题主要考查C++中字符串函数的使用。strcpy(s1,s2)将s2的内容赋值到s1中; strcat(s1,s2)连接s1和s2两个字符串;strlen(s)返回字符数组s的长度。因此最后输出的结果是b和c进行连接后的字符串长度,即7。
转载请注明原文地址:https://jikaoti.com/ti/vjL0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
结构化程序设计主要强调的是()。
有下列程序:#include<stdio.h>#defineS1(x,y)x*y#defineS2(x,y)(x)*(y)main(){inta=2,b=5:printf("%d,%d,%d,%d",S1(a+b,a+b),S1(a+
有以下程序:#include<stdio.h>structtt{intx;structtt*y;}*P。struct*tt*a[4]={20,a+1,15,a+2,30,a+3,17,a};main(){inti;P=a:for(
设有定义语句:char*aa[2]={"abcd","ABCD"};则下列叙述正确的是()。
定义学生选修课程的关系模式如下: S(S#,Sn,Sd,Sa)(其属性分别为学号、姓名、所在系、年龄) C(C#,Cn,P#)(其属性分别为课程号、课程名、选修课) SC(S#,C#,G)(其属性分别为学号、课程号、成绩) 检索选修了课程名为“操作
以下选项中,能用作用户标识符的是()。
下列选项中不是关系数据库基本特征的是()。
一个算法应当具有5个特性,以下叙述中正确的是()。
关于类的继承的特性,不正确的是()。
对于条件表达式(k)?(i++):(i--)来说,其中的表达式k等价于()
随机试题
冲裁间隙是一个很重要的工艺参数,它对冲裁件的__________等均有较大影响。
卫星通信的频率范围一般选在微波波段的()
药物警戒的工作内容是()。
城市快速路、主干路的沥青混凝土混合料宜采用( )搅拌机拌和。
非货币性资产交换具有商业实质,但换入或换出资产的公允价值不能可靠计量,且不涉及补价时,换入资产入账价值的确定基础是()。
下列关于美国基金国际化的说法错误的是()。
无论企业采用何种方式评估信用风险是否显著增加,通常情况下,如果逾期超过60日,则表明金融工具的信用风险已经明显增加。()
货币法定存款准备金率×原始存款总额货币乘数等于()。
体育课上,全班同学站成一排按1至5报数,凡报到5的同学出列。余下的同学仍按1至5报数,同样报到5的同学出列。这样进行了6轮,还剩下19人,则全班共有人数为()。
提出著名的POSDCORB七大行政职能的是()。
最新回复
(
0
)