首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
执行下列语句: #include using namespace std; int main() { int x=3: if(x=5) cout
执行下列语句: #include using namespace std; int main() { int x=3: if(x=5) cout
admin
2015-08-14
60
问题
执行下列语句:
#include
using namespace std;
int main()
{
int x=3:
if(x=5)
cout<
else
cout<
return 0:
}
程序的输出是( )。
选项
A、3
B、4
C、5
D、6
答案
C
解析
if(条件)语句1 else语句2,语句的执行过程是:首先判断条件是否为真(不为0),为真则执行语句1,否则执行语句2。题目中的条件是x=5,意思是把5赋予变量x,它将x置5且返回一个真值。
转载请注明原文地址:https://kaotiyun.com/show/hvNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
进行文件操作时需要包含()文件。
下列程序中,划线处正确的语句是()。#include<iostream.h>ClassBase{Public:Voidfun(){cout<<"Base::fun"<<endl;}};Cl
下面关于运算符重载的描述错误的是
对于下面的程序ifstreamfin(c:\test.txt);if(fin)cout<<"ok";elsecout<<"wrong";对于if语句中的内容可
以下程序段共有错误()处。#include<iostream>usingnamespacesstd;classSample{private:intn;public:
下列叙述中错误的是
下列叙述中正确的是
下列关于动态联编的描述中,错误的是()。
对于下面的程序,说法正确的是 #include<iostream.h> voidmain() {intx=3,y=4,z=2; if(X=y+z)cout<<"x=y+Z"; elsecout<<"x!=y+Z";}
设计程序时,应采纳的原则之一是()。
随机试题
下列各项中,属于常规授权的是
骨骼肌细胞兴奋一收缩耦联的关键因素是()。
根据资料,回答下列问题:2012年,某地区农作物播种总面积达到1625.55万亩,同比增长4.6%。其中,粮食和蔬菜播种面积大幅增长,分别为459.40万亩、109.06万亩,同比增长32.7%和30.5%;棉花、油料和甜菜播种面积下降,分别为698.
(2014年第31题)中华民族的爱国主义优良传统源远流长,内涵极为丰富,下列诗句中反映爱国主义优良传统的有
Theterme-commercereferstoallcommercialtransactionsconductedovertheInternet,includingtransactionsbyconsumersandb
排序是计算机程序设计中的一种重要操作,常见的排序方法有插入排序、______和选择排序。
Whatdidwomenusuallydobeforetheirmarriage?
Wheredoesthewomanwork?
"Museum"isaslipperyword.Itfirstmeant(inGreek)anythingconsecratedtotheMuses:ahill,ashrine,agarden,afestival
DearMr.Green,Pleaseshipusorangemarmalade(柑橘酱)asperthefollowingterms:Quantity:20,000jarsUnit:1kgperj
最新回复
(
0
)