首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的运行结果为 #include < iostream.h > void swap ( int &a,int b ) { int temp; temp=a++; a=b;
下面程序的运行结果为 #include < iostream.h > void swap ( int &a,int b ) { int temp; temp=a++; a=b;
admin
2009-02-15
40
问题
下面程序的运行结果为 #include < iostream.h > void swap ( int &a,int b ) { int temp; temp=a++; a=b; b=temp; } void main( ) { int a=2,b=3; swap(a,b) ; cout << a <<"," << b << end1; }
选项
A、2,3
B、3,2
C、2,2
D、3,3
答案
8
解析
本题考查的是引用调用,因为函数swap引用调用参数a,所以在swap函数中a的变化会改变主函数中a的值,即a自加1,但b的值并未改变。
转载请注明原文地址:https://kaotiyun.com/show/6dkp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序:#includeintf(intx){inty;if(x==0‖x==1)return(3);y=x*x—f(x一2);returny;main()
若有定义:charc;intd;程序运行时输入:c=1,d=2<回车>,能把字符1输入给变量c、整数2输入给变量d的输入语句是
下面关于数据库三级模式结构的叙述中,正确的是()。
两次运行下面的程序,如果从键盘上分别输入3和2,则输出结果是()。#inc1udemain(){intx;scanf(”%d”,&x);if(x++>2)printf(”%d”,X);
以下选项中合法的变量是
对下图二叉树进行前序遍历的结果为()。
以下数据结构中,属于非线性数据结构的是()。
下列方法中,不属于软件调试方法的是()。
在软件开发中,需求分析阶段产生的主要文档是()。
C语言程序中,运算对象必须是整型数的运算符是()。
随机试题
司法体系是需要警察来维护的,如果警察不尽职,就不可能有一个良好的司法体系。所以,如果警察尽职了,就会有一个良好的司法体系。下列哪项作为前提。能保证题干结论的成立?
1)______NoamChomsky2)______D.A.Wilkins3)______Piaget4)______Hymes5)______StephenKrashena)cogniti
A.精氨酸B.人工肝C.二者均是D.二者均非(2003年第122题)治疗慢性肝性脑病用
下列有关生物利用度的描述错误的是:
患者女性,45岁,主因"干咳,查体发现双肺门淋巴结肿大1个月"入院。体检:双肺未闻及干湿性啰音,血常规正常,PPD试验阴性
A.参苓白术散B.清肝引经汤C.固本止崩汤D.顺经汤加牛膝E.健固汤合四神丸
关于民用爆破器材许可证制度的说法,错误的是()。
信贷资金的运动特征有()。
阅读下面这首唐诗,回答问题。赤壁杜牧折戟沉沙铁未销,自将磨洗认前朝。东风不与周郎便,铜雀春深锁二乔。有人认为这首诗的第四句可改为“国破人亡在此朝",你怎么看
在我国,软件著作权(12)产生。(2011年5月试题12)
最新回复
(
0
)