首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的运行结果为( )。 #include<iostream.h> void swap(int &a,int B) { int temp; temp=a++; a=b; b=temp; } void
下面程序的运行结果为( )。 #include<iostream.h> void swap(int &a,int B) { int temp; temp=a++; a=b; b=temp; } void
admin
2010-12-16
39
问题
下面程序的运行结果为( )。 #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
答案
D
解析
本题考查的是引用调用,因为函数swap引用调用参数a,所以在swap函数中a的变化会改变主函数中 a的值,即a自加1,但b的值并未改变。
转载请注明原文地址:https://jikaoti.com/ti/25L0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下程序的输出结果是()。#include<stdio.h>main(){inta=8,b=6,m=1;switch(a%4){case0:m++;break;case1:m
有以下程序:#includemain(){intk=5,n=0;do{switch(k){ease1:ease3:n+=1;k一一;break;default:n=0;
有以下程序:#include<stdio.h>#definePT3.5;#defineS(x)PT*x*x;main(){inta=1,b:2;printf("%4.1f\n",S(a+b));}程序运行后的输出结果是()。
给定程序MODll.C中函数fun的功能是:从3个红球,5个白球,6个黑球中任意取出8个作为一组,进行输出。在每组中,可以没有黑球,但必须要有红球和白球。组合数作为函数值返回。正确的组合数应该是15。程序中i的值代表红球数,j的值代表白球数,k的
下列程序的输出结果是()。#includevoidfun(int*a,int*b){int*k;k=a;a=b;b=k;}main(){inta=1,b=2,*x=&a,*y=&b;fun(x,y)
有以下程序:#include<stdio.h>#include<string.h>main(){charstr[][20]={"One*world","One*Dream!"},*p=str[1];printf("%d,",strlen(p));
以下程序的输出结果是()。#includestructst{intx;int*y;}*p;intdt[4]={1,2,3,4};structstaa[4]={2,&dt[0],3,&dt[
以下程序的输出结果是()。#inc1udemain(){inta=1,b—3;if(++a
有三个关系表R、S和T,其内容如下:其中关系T由关系R和S通过某种操作得到,该操作为()。
设有以下函数:voidfun(intn,char*s){……}则下面对函数指针的定义和赋值均是正确的是()。
随机试题
目前,在我国有权办理涉外公证业务的机构是()
男,44岁,右上腹胀痛3天。伴寒战、高热(39.2℃),食欲不振,乏力。右上腹皮肤有凹陷性水肿。肝肋下5cm,有压痛。血WBC19×109/L,N0.92。B超示右肝内多个2~3cm大小的液性暗区。X线片示右膈肌升高,肝阴影增大。抗感染治疗主要针对的细
A.槐花B.银杏叶C.山楂D.黄芩E.葛根有效成分为芦丁的中药为()。
某县政府发布通知,对直接介绍外地企业到本县投资的单位和个人按照投资项目实际到位资金金额的千分之一奖励。经张某引荐,某外地企业到该县投资500万元,但县政府拒绝支付奖励金。县政府的行为不违反下列哪些原则或要求?
下列叙述正确的是()。
现金溢余核查后原因不明,则应()。
广州白鹳塑料制品有限公司与台湾锦云贸易有限公司签订印花塑料餐具加工合同,由锦云公司向白鹳公司免费提供ABS树脂一批,并支付加工费,成品由锦云公司在境外销售。白鹳公司为此向海关申领了加工贸易手册。在加工过程中,由于没有印花设备,白鹳公司报经主管海关同意后,将
经济增长与经济发展的关系是( )。
A、 B、 C、 D、 B和操作系统一样,可以将DBMS划分成若干层次。清晰、合理的层次结构可以帮助我们更清楚地认识DBMS,有助于DBMS的设计和维护。层次结构是按照处理对象的不同来划分的,最上层是应用层,
______mustlovestudents.
最新回复
(
0
)