问题
单项选择题
下面程序的运行结果为()。
#include<iostream.h>
void swap (int &a, int b)int temp;
temp=a++;
a=b;
b=temp;void main()int a=2, b=3;
swap(a,b);
cout<<a<<","<<b<<end1;
A. 2,3
B. 3,2
C. 2,2
D. 3,3
答案
参考答案:D
下面程序的运行结果为()。
#include<iostream.h>
void swap (int &a, int b)int temp;
temp=a++;
a=b;
b=temp;void main()int a=2, b=3;
swap(a,b);
cout<<a<<","<<b<<end1;
A. 2,3
B. 3,2
C. 2,2
D. 3,3
参考答案:D