首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 main( ) { int m=3,n=4,x; x=-m++; x=x+8/++n; printf("%d\n",x); } 程序运行后的输出结果是
有以下程序 main( ) { int m=3,n=4,x; x=-m++; x=x+8/++n; printf("%d\n",x); } 程序运行后的输出结果是
admin
2006-08-25
14
问题
有以下程序
main( )
{ int m=3,n=4,x;
x=-m++;
x=x+8/++n;
printf("%d\n",x);
}
程序运行后的输出结果是
选项
A、3
B、5
C、-1
D、-2
答案
D
解析
本题涉及运算符的优先级,见程序中,第一行为数据定义及初始化,第二行“++”的优先级高于“—”所以,运行第二行后x的值为—4,第三行中“/”的优先级高于“++”,所以,先进行除法运算,再对n进行“++”运算,得出结果应为-4+8/4 = -2。
转载请注明原文地址:https://kaotiyun.com/show/x4Hp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下可以作为VisualBasic变量名的是
以下数列:1,1,2,3,5,8,13,21…的规律是从第3个数开始,每个数都是其前面两个数之和。在考生文件夹下有一个工程文件sjt5.vbp。窗体中已经给出了所有控件:如图所示。请编写适当的事件过程完成如下功能:选中一个单选按钮后,单击“计算”
在考生目录下有一个工程文件sjt5.vbp,其窗体上有一个文本框,名称为Text1;还有两个命令按钮,名称分别为C1、C2,标题分别为“计算”、“存盘”,如图1-201所示。有一个函数过程isprime(a)可以在程序中直接调用,其功能是判断参数a是否为
在考生文件夹下有一个工程文件sjt5.vbp,界面如图2-137所示,其功能如下:①单击”读数据”按钮,则把考生文件夹下文件in5.dat中的12组整数(其中每组含有10个数,共计120个整数)读到数组a中;②单击”计算”按钮,则对每组数求平均值,并将
在考生文件夹下有一个工程文件sjt5.vbp,其窗体上有两个标题分别为“读数据”和“统计”的命令按钮。请画两个标签,其名称分别是Label1和Label2,标题分别为“单词的平均长度为”和“最长单词的长度为”;再画两个名称分别为Text1和Text2、初
下列可以打开随机文件的语句是
设有如下声明语句OptionBase1Dimarr(2,-1To5)AsInteger则数组arr中数组元素的个数是
设x为一整型变量,且语句的开始为:SelectCasex,则不符合语法规则的Case子句是
以下选项中,不合法的VisualBasic的变量名是( )。
以下关于VB特点的叙述中,错误的是()。
随机试题
沈某,男,45岁,晨起发现自己左侧半身瘫痪,眼球震颤,共济失调,吞咽困难。该患者最可能的诊断是()。
下列选项中,()行为不应填写出口货物报关单。
在并购中,并购企业不必拥有巨额资金,只需要准备少量(用以支付并购过程必需的律师、会计师等费用)现金,加上被并购企业的资产及营运所得作为融资担保和还贷资金,便可并购任何规模的企业的并购类型是()。
Hewasluckier,however,becausehewasonlyslightlywounded.
下列选项中,不属于数据管理员(DBA)职责的是()。
江老师使用Word编写完成了课程教案,需根据该教案创建PowerPoint课件,最优的操作方法是()。
ManyAmericansfindsilenceuncomfortableduringabuffetoraformaldinner.【C1】______intheStatesthereisthe【C2】______
Theuseofcarsisbecomingmoreandmorepopularinthetwentiethcentury.Alargenumberoftheworld’spopulationisnowable
Whatistheconversationmainlyabout?
Largecompaniesneedawaytoreachthesavingsofthepublicatlarge.Thesameproblem,onasmallerscale,facespractically
最新回复
(
0
)