下面程序的运行结果为( )。 #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
第1题:
下面程序的运行结果为( )。#include<iostream.h>
voidswap(int&a,intb)
{
int temp;
temp=a++;
a=b:
b=temp:
}
voidmain()
{
inta=2,b=3;
swap(a,b);
cout<<a<<","<<b<<endl;
}
A.2,3
B.3,2
C.2,2
D.3,3
A.2,3
B..3,2
C.2,2
D.3,3
第2题:
下列程序的执行结果为 #include<iostream.h> void main() { int a=3,b=0; int * p=&a; b=+a++; cout<< * p<<”,” <<b<<endl; } A)3,4 B)4,3 C)3,4 D)4,4 (15)下面程序的运行结果为 #include<iostream.h> void main() { for(int a=0,x=0;! x&&a<=10;a++) { a++; } cout<<a<<end1; }
A.10
B.11
C.12
D.0
第3题:
下面程序的运行结果为( )。#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
第4题:
下面程序的运行结果为( )。 #include<iostream.h> void swap(int&a,int B. int temp; temp=a++: a=b: b=temp; } void main { im a=2,b=3; swap(a,B.; eout<<a<<”,”<<b<<endl; }
A.2,3
B.3,2
C.2,2
D.3,3
第5题:
下面程序的运行结果为 #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