首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果是( )。 #include<stdio.h> main() { int a=2,b=3,p; p=f(a,b); printf("%d",p); } int f(a,b
下列程序的输出结果是( )。 #include<stdio.h> main() { int a=2,b=3,p; p=f(a,b); printf("%d",p); } int f(a,b
admin
2010-09-05
16
问题
下列程序的输出结果是( )。 #include<stdio.h> main() { int a=2,b=3,p; p=f(a,b); printf("%d",p); } int f(a,b) { int c; if(a>b)c=1; else if(a==b)c=0; else c=-1; return(c) ; }
选项
A、-1
B、0
C、1
D、2
答案
1
解析
本题考查if else语句。在int f(a,b)中:第一个if语句,先判断条件,发现a>b条件不成立,则执行与其配对的else语句;第二个if语句,先判断条件,发现a==b条件不成立,则执行与其配对的else语句,c=-1。
转载请注明原文地址:https://kaotiyun.com/show/HqWp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下面程序运行后,语句“Printi”执行的次数是()。PrivateSubForm_Click()DimiAsInteger,jAsIntegeri=0Doi=i+1For
要删除列表框中最后一个列表项,正确的语句是( )。
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是( )。
在窗体上有两个名称分别为Text1、Text2的文本框,一个名称为Command1的命令按钮。运行后的窗体外观如图所示。设有如下的类型和变量声明:PrivateTypePerson nameAsString*8 majorAsSt
执行以下程序段:a$="VisualBasicProgramming"b$="C++"c$=UCase(Left$(a$,7))&b$&Right$(a$,12)后,变量c$的值为( )。
如果在框架中画了2个复选框,且框架的Enabled属性被设置为False,2个复选框的Enabled属性被设置为True,则下面叙述中正确的是()。
在窗体上画一个通用对话框,程序运行中用ShowOpen方法显示"打开"对话框时,希望在该对话框的"文件类型"栏中只显示扩展名为DOC的文件,则在设计阶段应把通用对话框的Filter属性设置为( )。
设有如下关系表:则下列操作正确的是()。
假定有如下的程序段:DimintVarAsIntegerintvar=TruePrintintVar则输出结果是
随机试题
甲地发生旱灾,从外地运到一批救灾物资,该地乙乡政府委托各村发放救灾物资,丙村在发放救灾物资时把张某遗漏,张某不服想提起行政诉讼。 请问:张某应以谁为被告?为什么?
金樱子的主治病证是()
用标准预算审查法审查施工图预算,其特点之一是()。
炮孔孔深超过()m时,禁止用火花起爆.
()是接受受托机构委托,负责保管信托财产账户资金的机构。
下列选项中,属于金融期货主要交易制度的有()。Ⅰ.限仓制度Ⅱ.逐日盯市制度Ⅲ.集中交易制度Ⅳ.有负债的结算制度
2015年1月15日,甲出资5万元设立A个人独资企业(下称“A企业”),主要从事铁皮的加工。甲聘请乙管理企业事务,同时规定,凡乙对外签订标的超过1万元的合同,须经甲同意。2月10日,乙未经甲同意,以A企业名义向善意第三人丙购入价值2万元的货物。3月15日,
材料:语文课上,吴老师正和同学们尽情地“畅游”在《颐和园》这幅清新、美丽的“画卷”中。突然,一只小手高高举起:“老师,课文第四自然段‘游船、画舫在湖面慢慢地滑过,几乎不留一点儿痕迹’中的‘滑’字,应该改成‘划船’的‘划’。”这位同学突然的提问似乎
在下列()市场中,组合管理者会选择消极保守型的态度,只求获得市场平均的收益率水平?
我国1993年《公司法》第5条关于“公司以其全部法人财产,依法自主经营,自负盈亏”的规定,是属于()。
最新回复
(
0
)