首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序的输出结果是 #include<iostream.h> void main( ) {int x=1,y=3; cout << x++ << ","; {int x
以下程序的输出结果是 #include<iostream.h> void main( ) {int x=1,y=3; cout << x++ << ","; {int x
admin
2009-02-15
18
问题
以下程序的输出结果是 #include<iostream.h> void main( ) {int x=1,y=3; cout << x++ << ","; {int x=0;x+=y*2; cout <<X <<"," <<y << ","; } cout << x <<","<< y; }
选项
A、1,6,3,1,3
B、1,6,3,6,3
C、1,6,3,2,3
D、1,7,3,2,3
答案
4
解析
cout<<x++;语句中,程序先输出x的值,然后再加1,所以结果为1,此时x的值为2;在 int x=0;x+=y*2;语句中,将0的值赋给x,然后再运算 x+=y*2的值,结果为x=6(此时x的值为局部变量),y的值不变,在最后在执行了x语句后的值,所以应为2。
转载请注明原文地址:https://kaotiyun.com/show/HKkp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下函数中,findmax拟实现在数组中查找最大值并作为函数值返回,但程序中有错导致不能实现预定功能。#defineMIN—2147483647intfindmax(intx[],intn){inti,
有以下程序#include<stdio.h>main(){intx=35,B;charz=’B’;B=((x)&&(z<’b’));printf("%d
有以下程序:#include<stdio.h>intadd(inta,intb){return(a+b);}main(){intk,(*f)(),a=5,b=10;f=add;}则以下函数调用语句错误的是()。
设有定义:intk=0;,下列选项的4个表达式中与其他3个表达式的值不相同的是()。
数据流图用于抽象描述一个软件的逻辑模型,数据流图由一些特定的图符构成。下列图符名标识的图符不属于数据流图合法图符的是()。
己知下列函数定义:fun(int*intc,intamintdata){intk;for(k=0;k<m*n;k++){*b=data;b++;}}则调用此函数的正确写
下列语句组中,不正确的是()。
要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()。
算法的时间复杂度是指
运算符重载是对已有的运算符赋予多重含义,因此()。
随机试题
Thestrong,light-weightbamboomakesanexcellentreinforcementforconcrete.
解剖上,关于正常左心室与右心室的主要区别,正确的是
根据下面材料。回答下列题目:投资者预测来年的市场收益率为12%,国库券收益率为4%。CFI公司股票的贝塔值为0.50,在外流通股的市价总值为1亿美元。假定该股票被公正地定价,投资者估计其期望收益率为( )。
Beforedoingawritingtask,theteacherelicitsstudents’ideasbyaskingthemtolistasmanywordsorphrasesthatcomeinto
我国最大的内陆咸水湖是()。
人工智能是指由人工制造出来的系统所表现出来的智能。人工智能的核心问题包括推理、知识、规划、学习、交流、感知、移动和操作物体的能力等。下列论述中所描述的各项技术突破,无关人工智能的是:
毛泽东从边区教育实际出发,提出“不但要有集中的正规的小学、中学,而且要有分散的不正规的村学、读报组和识字组。不但要有新式学校,而且要利用旧的村塾加以改造。”这句话体现了抗日战争时期中国共产党的教育方针政策中的
在窗体上画一个组合框,一个命令按钮和一个文本框,其名称分别为Combo1,Command1和Text1,然后编写如下事件过程:PrivateSubForm_Load() Combo1.AddItem"AAAAA" Combo1.AddI
•Lookatthestatementsandthematerialsaboutmarketingdisastersbelow.•Whichstory(A,B,CorD).doeseachstatement1—7
A、Itisconductedinclassandtheotherteachersprovidefeedback.B、Itisdoneathomewithstudents.C、Itispreparedbythe
最新回复
(
0
)