下列程序的运行结果为( )。 #include void print(double a) { cout

admin2017-02-18  22

问题 下列程序的运行结果为(    )。
    #include
    void print(double a)
    {
    cout<<++a:
    }
    void print(int a,int b)
    {
    cout<    }
    void main()
    {
    print(1.2);
    cout<<"":
    print(3,4);
    }

选项 A、1.2  34
B、2.2  34
C、1.2  43
D、2.2 43

答案D

解析 本题考查的是对重载函数的掌握,因为++a是右结合的,所以a先自加1再输出,即为2.2,之后调用函数print(int a,int b)输出b和a,即43。
转载请注明原文地址:https://kaotiyun.com/show/bBAp777K
0

最新回复(0)