首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; int fun1(int x) { return ++x; } int fun2(int& x) { re
有如下程序: #include using namespace std; int fun1(int x) { return ++x; } int fun2(int& x) { re
admin
2015-07-22
27
问题
有如下程序:
#include
using namespace std;
int fun1(int x) { return ++x; }
int fun2(int& x) { return ++x; }
int main() {
int a=0,b=0,c=0;
c=fun1(a)+fun2(b);
cout<
return 0;
}
运行后的输出结果是
选项
A、002
B、012
C、102
D、112
答案
B
解析
程序定义了两个函数,fun1和fun2,功能都是对形参x自增1,然后返回自增后的值,其中fun2的形参x为引用类型,形参x自增1的同时实参的值也自增1;main函数中定义三个整型变量a=0,b=0,c=0,调用fun1(a)返回值为1,调用fun2(b)返回值为1,同时实参b的值被修改为1,所以c的值为1+1=2,程序输出a、b、c为0,1,2;答案为B。
转载请注明原文地址:https://kaotiyun.com/show/MMNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
语句cout<<setprecision(2)<<1024.4567;的输出结果为
不能重载的运算符是
下列有关数据库的描述,正确的是
数据库、数据库系统和数据库管理系统之间的关系是()。
下面是关于ios类的叙述,正确的是()。
重载输入流运算符>>必须使用的原型为
关于虚函数,下列表述正确的是()。
在一个长度为n的线性表中插入一个元素,以下说法不正确的是()。
带一个long类型参数的流成员函数______按参数值设置flags状态变量,并返回以前设置的标志值。
随机试题
()包括对与工作有关的事故、事件,其他损失(如财产损失),不良的职业健康安全绩效和职业健康安全管理体系的失效情况的确认、报告和调查。
OnthefourthThursdayinNovember,AmericanscelebratethefeastofThanksgiving.Thisfeastisatimewhenthefamilycomesto
对破伤风患者的护理正确的是
某患者.右上中切牙金属烤瓷冠修复后。检查:金属烤瓷冠颜色、形态良好,不松动.颈部边缘探针可探入.邻接点牙线可以勉强通过.正中合时右下1切端咬在金属烤瓷冠的瓷面上.此冠为
某宾馆为了8月8日的开业庆典,于8月7日向电视台租借一台摄像机。庆典之日,工作人员不慎摔坏摄像机,宾馆决定按原价买下,以抵偿电视台的损失,遂于8月9日通过电话向电视台负责人表明此意,对方表示同意。8月15日,宾馆依约定向电视台支付了价款。摄像机所有权何时转
2007年1月2日,乙公司涉及一起诉讼案。2007年12月31日,乙公司尚未接到法院的判决。根据公司法律顾问的职业判断,公司认为,胜诉的可能性为40%,败诉的可能性为60%。如果败诉,需要赔偿450~525万元之间,同时还应承担诉讼费3万元。乙公司在资产负
纳税人应当在向公安机关等车辆管理机构(),缴纳车辆购置税。
某单位需要派出下乡扶贫人员1至2人。经过宣传号召,众人纷纷报名。经过一番考虑,领导最后将扶贫人选集中在小王和小张两人身上。大家对最终的挑选结果作了如下猜测:(1)小王会被挑选上。(2)如果小王被挑选上,那么小张就不会被挑选上。
设f(x)在[1,+∞)上有连续的二阶导数,f(1)=0,fˊ(1)=1,且二元函数z=(x2+y2)f(x2+y2)满足,求f(x)在[1,+∞)的最大值
For:【L5】______Blake.From:【L6】______Anderson.Tomorrow’s【L7】______iscancelled.Helen’stelephonenumber:【L8】______.【L8】
最新回复
(
0
)