问题 单项选择题

下列程序的运行结果为( )。# include < iostream.h >voidprint (double a){cout << ++a;}void print (int a,int b){cout << b << a;}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。

填空题
问答题 案例分析题