未分类题

下列程序的运行结果是( )。 #include<iostream.h> void fun(int &a,int b=3) { static int i=2; a=a+b+i; i=i+a; } void main() { int x=5,y=2; fun(x,y); cout<<x<<','; fun(x); cout<<x<<end
A.5,2
B.7,11
C.11,23
D.9,23

A.h>
B.5,2
B.7,11
C.11,23

【参考答案】

D
解析: 由程序中的主函数main入手,定义了变量x=5,y=2。然后调用fun函数,其中a为引用地址,其改变......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)