若下面程序运行时输出结果为: 1,A,10.1 2,B,3.5 请将程序补充完整。 #include using namespace std; intmain() { void test

admin2012-12-29  34

问题 若下面程序运行时输出结果为:
    1,A,10.1
    2,B,3.5
    请将程序补充完整。
    #include
    using namespace std;
    intmain()
    {
       void test(int,char,double__________);
       test(1,‘A’,10.1);
       test(2,‘B’);
       return 0:
    }
    void test(int a,char b,double c)
    {
    cout<    }

选项

答案=3.5

解析 本题考查了函数默认参数的应用。本题中第一次调用test()函数数值1,A,10.1;第二次调用少了一个实参,却要求输出2,B,3.5,由此分析,应将test()函数的第三个参数声明为默认参数。且默认为3.5,才能达到要求的输出结果。故应填入=3.5或者c=3.5。
转载请注明原文地址:https://kaotiyun.com/show/8MVp777K
0

最新回复(0)