首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若下面程序运行时输出结果为 1,A,10.1 2,B,3.5 #include <iostream> using namespace std; int main() { void test(int, cha
若下面程序运行时输出结果为 1,A,10.1 2,B,3.5 #include <iostream> using namespace std; int main() { void test(int, cha
admin
2009-03-15
11
问题
若下面程序运行时输出结果为
1,A,10.1
2,B,3.5
#include <iostream>
using namespace std;
int main()
{
void test(int, char, doubie【 】);
test(1, ’A’, 10.1 );
test(2, ’B’);
return 0;
}
void test(int a, char b, double c)
{
cout<<a<<’,’<<b<<’,’<<c<<endl;
}
选项
答案
3.5
解析
本题考查了函数默认参数的应用。本题定义的函数test()仅仅是按顺序输出了三个形参值,题目中第1次调用该函数会输出1,A,10.1,但第2次调用少了一个实参却要求输出2,B,3.5。由此可见,应该将test()函数的第3个参数声明为默认参数,且默认值为3.5。故应该填入=3.5,或加上形参名c=3.5。
转载请注明原文地址:https://kaotiyun.com/show/rsjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
对关系S和R进行集合运算,结果中既包含S中的所有元组也包含R中的所有元组,这样的集合运算称为()。
下列一维数组说明rfl,不正确的是()。
设有定义:intx=0,*p;紧接着的赋值语句正确的是()。
下列方法中,不属于软件调试方法的是()。
设文件指针fp已定义,执行语句fp=fopen("file","w");后,以下针对文本文件file操作叙述的选项中正确的是()。
请编写函数fun,其功能是分别统计形参t所指二维数组中字母A和C的个数。注意:部分源程序存在PROG1.C中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。1#include<stdio.h>
给定程序中,函数fun的作用是:不断从终端读入整数,由变量a统计大于0的个数,用变量c来统计小于0的个数,当输入0时结束输入,并通过形参pa和pb把统计的数据传回主函数进行输出。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果
以下叙述错误的是()。
程序定义了N×N的二维数组,并在主函数中自动赋值。请编写函数fun(inta[][N],intn),该函数的功能是:使数组左下半三角元素中的值乘以n。例如,若n的值为3,a数组中的值为:则返回主程序后a数组中的值应为:注意:部分源程序给出如下。
以下关于C语言数据类型使用的叙述中错误的是()。
随机试题
蜗杆传动齿侧间隙的检查对于要求较高的用百分表方法测量。()
下潜油电泵摘扣油管吊卡时,吊卡的开口始终朝向电缆一边,油管上的电缆要朝向电缆滚筒那边。()
能用于不同性质数据的研究和比较的是()
假小叶的基本病变有
堆石坝坝料压实质量检查,应采用碾压参数和干密度(孔隙率)等参数控制,以控制()为主。
高斯过程经过线性系统后仍是高斯过程。()
根据所给资料,回答下列问题。2015年4月,受理量高于2015年一季度平均水平的专利类型有几种?
按照刑法的规定,下列犯罪人中,不可能被减刑的对象是( )。
马克思说:“手推磨产生的是封建主的社会,蒸汽磨产生的是工业资本家的社会。”这表明
Manymobileoperatorsalreadyofferaselectionoftelevisionchannelsorindividualshows,whicharesent(1)_____acrosstheir
最新回复
(
0
)