首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include #define PT 3.5; #define S(x)*x*x main() { int a=1,b=2; prinff(“%4.1f\n”,S(a+b));
有以下程序: #include #define PT 3.5; #define S(x)*x*x main() { int a=1,b=2; prinff(“%4.1f\n”,S(a+b));
admin
2020-05-19
25
问题
有以下程序:
#include
#define PT 3.5;
#define S(x)*x*x
main()
{
int a=1,b=2;
prinff(“%4.1f\n”,S(a+b));
}
程序运行后的输出结果是( )。
选项
A、31.5
B、7.5
C、程序有错无输出结果
D、14.0
答案
C
解析
宏定义不是C语句,结尾不加“;”,所以该程序会出现编译错误,答案选C。
转载请注明原文地址:https://kaotiyun.com/show/SACp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序MODI1.C中函数fun的功能是:求整数x的y次方的低3位值。例如,整数5的6次方为15625,此值的低3位值为625。请改正函数fun中指定部位的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得
给定程序中,函数fun的功能是:把形参s所指字符串中下标为奇数的字符右移到下一个奇数位置,最右边被移出字符串的字符绕回放到第一个奇数位置,下标为偶数的字符不动(注:字符串的长度大于等于2)。例如,形参s所指的字符串为:abcdefgh,执行结果为:ahcb
以下程序中函数sort的功能是对a数组中的数据进行由大到小的排序voidsort(inta[],intn){inti,j,t;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)
函数fun的功能是进行数字字符转换。若形参ch中是数字字符’0’~’9’,则’0’转换成’9’,’1’啭换成’8’,’2’转换成’7’,……,’9’转换成’0’;若是其他字符则保持不变;并将转换后的结果作为函数值返回。请在程序的下划线处填入正确的
给定程序MODI1.C中函数fun的功能是:输出M行M列整数方阵,然后求两条对角线上元素之和,返回此和数。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!1#inclu
请编写函数fun:在形参指针所指的4个整数中找出最大值和最小值,最大的放在a中,最小的放在d中。注意:部分源程序存在PROG1.C中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。1#include
下列给定程序中,函数fun的功能是:把形参a所指数组中的奇数按原顺序依次存放到a[0]、a[1]、a[2]…中,把偶数从数组中删除,奇数个数通过函数值返回。例如,若a所指数组中的数据最初排列为:9,1,4,2,3,6,5,8,7,删除偶数后,a
下列给定程序中,函数fun的功能是:对N名学生的学习成绩,按从高到低的顺序找出前m(m≤10)名学生来,并将这些学生的数据存放在一个动态分配的连续存储区中,此存储区的首地址作为函数值返回。请改正程序中的错误,使它能得出正确的结果。注意:
若有定义语句:floatx[5]={1.0,2.0,3.0,4.0,5.0},*p=x;则错误引用x数组元素的是()。
关于C语言文件的叙述中正确的是()。
随机试题
Assessorinvitescandidatesinandindicateschairs.(ToCandidateAandCandidateB.)Goodmorning/afternoon.Mynameis____
建设和谐文化,是构建社会主义和谐社会的重要任务。建设和谐文化的根本是()
患者,女,35岁,右上腹隐约不适,CT平扫右肝内约4cm大小类圆形低密度灶,增强动脉期明显周边强化,延迟扫描等密度,最可能的诊断是
司某,女,42岁。近2日自觉胸中烦热,口苦咽干,口疮,腹痛喜暖,大便稀溏,舌尖红,苔黄,脉沉迟。临床诊断是( )。
没有土地就没有人类,也没有人类的生存和发展。
因子生态分析法的前提条件是()。
关于教育费附加的说法,正确的是()。
某公司因台风造成损失共计250万元,其中流动资产150万元,非流动资产100万元,获得保险公司赔偿80万元,则计入营业外支出的金额为()万元。
组织结构图绘制的基本图示主要包括()。
根据下面材料回答下列小题。下列年份中,财政拨款用于地质勘查投资的增长幅度最大的是()。
最新回复
(
0
)