以下程序执行后的输出结果是( )。 #include<iostream> using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y, int z,int r) { z = x+y; X = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第1题:
下面程序的输出结果是【 】。
include <iostream>
using namespace std;
int d=1;
fun(int p){
static int d = 5;
d+ =p;
cout<<d;
return (d) ;
}
void main ( ) {
int a =3;
cout<<fun ( a + fun (d) )<<endl;
}
第2题:
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第3题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
void fun()
{
static int a=0;
a+=2;
cout<<a;
}
int main()
{
int CC;
for(CC=1;cc<4;CC++)
fun();
cout<<end1;
return 0;
}
第4题:
有以下程序:
include <iostream>
using namespace std;
int main()
{
int i=010,j=10;
cout<<(++i)<<","<<i--<<end1;
return 0;
}
则该程序运行后的输出结果是【 】。
第5题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
第6题:
下列程序的输出结果是【 】
include<iostream>
using namespace std;
int main()
{
int num=500;
int &ref=num;
ref +=100;
cout<<num<<end1;
return 0;
}
第7题:
下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;
A.9
B.1
C.11
D.10
第8题:
给出以下程序的执行结果【 】。
include <iostream>
using namespace std;
int n=1;
void Fun();
int main ()
{
n++;
Fun ( );
if (n>0)
{
int n=5;
cout<<"Block: n="<<n<< ", ";
}
cout<< "Main: n="<<end1;
return 0;
}
void Fun ( )
{
int n=10;
cout<<"Fun: n="<<n<<",";
}
第9题:
以下程序执行后输出的结果是【 】。
include<iostream>
using namespace std;
int fac(int a,int b){
return(b-a)*a;
}
int main(){
int x=3,y=4,z=5,result;
result=fac(fac(x,y),fac(x,z));
cout<<result<<endl;
return 0;
}
第10题:
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第11题:
有以下程序: #include <iostream> using namespace std; int main() { int intone; int &rInt=intone; intone=5; rInt=7; cout<<intOne<<","<<rInt<<end1; return 0; } 上述程序执行后的输出结果是( )。
A.5,7
B.7,5
C.5,5
D.7,7
第12题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第13题:
程序的输出结果是【 】。
include <iostream>
using namespace std;
class A{
public:
A(){a=b=2;}
A(int i,int j){a=i;b=j;}
void display(){cout<<a<<b;}
private:
int a,b;
};
void main(){
A m,n(4,8);
m.display();
n.display();
}
第14题:
以下程序的输出结果为【 】。
include<iostream>
using namespace std;
void initialize(int printNo,int state=0);
void initialize(int printNo=l,int state);
int main()
{
initialize();
return 0;
}
void initialize(int printNo,int state)
{
cout<<printNo<<","<<state<<end1;
}
第15题:
下列程序的输出结果是【 】。
include <iostream>
using namespace std;
int main()
{
int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end 1;
return 0;
}
第16题:
以下程序的输出结果是【 】。
include<iostream>
using namespace std;
int main(){
int sum,i;
for(sum=0,i=1;i<5;i++)sum+=i;
cout<<sum<<endl;
return 0;
}
第17题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
int main()
{
int data=l;
int &r = data;
data+=5;
r+=5;
cout<<data<<endl;
return 0;
}
第18题:
下面程序输出的结果是( )。 #include <iostream> using namespace std; void swap(int &a,int &b){ int temp; temp=a; a=b; b=temp; } void main(){ int x=2; int y=3; swap(x,y); cout<<x<<y; }
A.23
B.32
C.ab
D.ba
第19题:
下面程序的输出结果为【 】。
include <iostream>
using namespace std;
void initialize(int printNo,int state=0);
void initialize(int printNo=1,int state);
int main()
{
initialize();
return 0;
}
void initialize(int printNo, int state)
{
cout<<printNo<<","<<state<<end1;
}
第20题:
下面程序执行的结果是【 】
include<iostream>
using namespace std;
class A{
public:
static int x;
A(inty){cout<<x+y;}
};
int A::x=2;
void main(){
A a(5);
}
第21题:
有以下程序: #include <iostream> using namespace std; void fun(int i,int j) { cout<<(i+j)<<end1; } void fun(int i) { cout<<i++<<end1; } int main() { int a=1; fun(A) ; return 0; } 该程序执行后的输出结果是( )。
A.1
B.2
C.3
D.4
第22题:
以下程序执行后的输出结果是 #include<iostream> using namcspace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第23题:
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int &c=a; a++; cout<<c; }
A.2
B.3
C.4
D.*a