下面程序的运行结果为
#include
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.2,3
B.3,2
C.2,2
D.3,3
第1题:
下面程序输出的结果为( )。 #include<iostream.h> void fun(int a,int b) { int temp; temp=a; a=b; b=temp; } void main() { int m,n; m=1; n=2; fun(m,n); cout<<m<<""<<n<<end1; }
A.12
B.21
C.22
D.程序有错误
第2题:
下面程序的运行结果为( )。 #include<iostream> using namespace std; 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<<ENDL; }
A.2,3
B.3,2
C.2,2
D.3,3
第3题:
下面程序的运行结果是____。 注意:数据之间用空格隔开 void swap(int a, int b) { int temp; temp=a; a=b; b=temp; } int main() { int i=3,j=5; if(i<j) swap(i,j); cout<<i<<" "<<j<<endl; return 0; }
第4题:
下面程序的运行结果为 #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
第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