下列程序段的输出结果是 #include<iostream.h> void fun(int * X,int * y) { cout < < * X < < * y; * X=3; * y=4; } void main( ) { int x=1,y=2; fun(&y,&x); cout < < X < < y < < end1; }
A.2143
B.1212
C.1234
D.2112
第1题:
下面程序的运行结果是
#include<iostream.h>
void fun(int * a,int * b)
{
int x= * a;
* a= * b; * b=X;
cout < < * a < < * b < <" ";
}
void main( )
{
int x=1,y=2;
fun(&x,&y) ;
cout < < X < < y < < endl;
}
A.12 12
B.12 21
C.21 12
D.21 21
第2题:
以下程序运行后的输出结果是【 】。
include<iostream.h>
void fun(int x,int y)
{ x=x+y;y=x-y;x=x-y;
cout<< x << "," <<y << " ,";}
void main( )
{ int x=2,y=3;fun(x,y);
cout<< x << "," << y << endl;}
第3题:
下面程序的运行结果是______。
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<<endl;
}
第4题:
有以下程序 #include<iostream.h> float fun(int x,int y) {return(x+y);} void main( ) {int a=2,b=5,c=8; cout<<fun((int)fun(a+c,b) ,a-c) ;}程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9
第5题:
有以下程序: #include<iostream.h> void fun(int a, int b, int c) { a=456,b=567,c=678;} void main( ) { int x=10,y=20,z=30; fun(x, y, z) ; cout < < x< < ',' < < y < < ',' < < z < < endl; } 输出结果是
A.30,20,10
B.10,20,30
C.456,567,678
D.678,567,456
第6题:
以下程序的输出结果是_____。
include<iostream.h>
void fun( )
{ static int a=0;
a+=2;
cout < < a < < " ";}
void main( )
{ int cc;
for(cc=1;cc<4;cc++)
fun( ) ;
cout < < endl;}
第7题:
下列程序段的输出结果是 #include<iostream.h> void fun(int * x,int * y) { cout << * X << * y; *X=3; *y=4; } void main() { int x=1,y=2; fun(&y,&x); cout << X << y<<endl; {
A.2143
B.1212
C.1234
D.2112
第8题:
下面程序的运行结果是【 】。
include <iostream>
using namespace std;
void fun(int &a, int b=3)
{
static int i=2;
a = a + b + i;
i = i + a;
}
int main()
{
int x=5, y=2;
fun(x, y);
cout<<x<<",";
fun(x);
cout<<x<<end1;
return 0;
}
第9题:
阅读下面程序:#include <iostream.h>fun (int a, int b){int c;c=a+b;return c;}void main(){int x=6, y=7, z=8, r;r=fun( (x--, y++, x+y), z--);cout<<r<<end1;}则该程序的输出结果是( )。
A.11
B.20
C.21
D.31
第10题:
下列程序的运行结果是( )。 #include<iostream.h> voidfun(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<<endl; }
A.5,2
B.7,11
C.11,23
D.9,23
第11题:
以下程序的输出的结果是( )。 #include<iostream.h> int x=3: void main() { void fun(); int i; for(i=1;i<x;i++) fun(); } void fun() { static int x=1; x*=x+1; cout<<x<<" "; }
A.3,3
B.2,2
C.2,6
D.2,5
第12题:
下列程序运行后的输出结果是( )。 #include<iostream.h> void fun(int,int,int*); void main() { int x,y,z; fun(5,6,&x); fun(7,x,&y); fun(x,y,&z); cout<<x<<","<<y<<","<<z<<end1; } void fun(int a,int b,int *c) { b+=a; *c=b-a; }
A.5, 5, 5
B.6, 6, 6
C.5, 6, 7
D.7, 7, 7
第13题:
阅读下列程序:
include<iostream.h>
void fun(int n)
{
int x(5);
static int y(10);
if(n>0)
{
++x;
++y;
cout<<x<<","<<y<<endl;
}
}
void main()
int m(1);
fun(m);
}
则该程序的输出结果是______。
第14题:
以下程序的执行结果是______。
include<iostream.h>
void main()
{
int x=5 y=2;
cout<<! (y==x/2)<<",";
cout<<(y!=x%3)<<",";
cout<<(x>0 && y<0=<<",";
cout<<(x!=y||x>=y)<<endl;
}
第15题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第16题:
有如下程序: #include <iostream> void fun(int& x, int y){int t=x;x=y;y=t;} int main () { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第17题:
有以下程序: #include<iostream.h> Float fun(int x, int y) { return(x+y) ;} void main( ) { int a=2,b=5,c=8; cout < < fun((int) fun(a+c, b) ,a-c) ;} 程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9.0
第18题:
以下程序的输出结果是
#include<iostream.h>
void main( )
{int x=1,y=3;
cout < < x++ < < ",";
{int x=0;x+=y * 2;
cout < < x < <"," < < y < <",";
}
cout < < x < < "," < < y;
}
A.1,6,3,1,3
B.1,6,3,6,3
C.1,6,3,2,3
D.1,7,3,2,3
第19题:
以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main() { int a=10; fun (2,2,a); cout<<a; }
A.0
B.4
C.10
D.无定值
第20题:
下面程序的输出结果是【 】。
include<iostream.h>
int add(int a, int b);
void main()
{
extern int x, y;
cout<<add(x, y)<<end1;
}
int x(20),y(5);
int add(int a, int b)
{
int s=a+ b;
return s;
}
第21题:
有以下程序 #include<iostream.h float fun(int x,int y) {return(x+y);} void main() {int a=2,b=5,c=8; cout<<fun((int)fun(a+c,b),a-c);} 程序运行后的输出结果是( )。
A.编译出错
B.9
C.21
D.9
第22题:
下列程序运行后的输出结果是( )。 #include<iostream.h> void fun(int,int,int*); void main() { int x,y,z; fun(5,6,&x); fun(7,x,&y); fun(x,y,&z); cout<<x<<","<<y<<","<<z<<endl; } void fun(int a,int b,int *c) { b+=a; *c=b-a; }
A.5,5,5
B.6,6,6
C.5,6,7
D.7,7,7
第23题:
下列程序的运行结果是( )。 #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