对于下面的程序,说法正确的是 #include<iostream.h> void main( ) { int x=3,y=4,z=2; if(X=y+z) cout <<"x=y+Z"; else cout<<"x!=y+Z";}
A.不能通过编译
B.输出6
C.输出x! =y+z
D.输出x=y+z
第1题:
下面程序的结果【 】。
include<iostream.h>
int f(int);
void main() {
int x=1, i;
for (i=0; i<3; i++)
cout<<f(x)<<‘ ’ ;
cout<<end1;
}
int f(int x){
int y=1;
static int z=3
y++;
z++;
return (x+y+z);
}
第2题:
下面程序的运行结果是______。
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;
}
第3题:
以下程序的运行结果是 #include<iostream.h> void sub(int x,int y,int *z) { *z=y-x;} void main( ) { int a,b,c; sub(10,5,&a) ; sub(7,a,&b) ; sub(a,b,&c) ; cout << a <<","<< b <<"," << c << en
A.5,2,3
B.-5,-12,-7
C.-5,-12,-17
D.5,-2,-7
第4题:
有如下程序: #include<iostream.h> int func(int a, int b) { return(a+b) ;} void main( ) { int x=2,y=5,z=8,r; r=func(func(x,y) ,z) ; cout < < r; } 该程序的输出的结果是
A.12
B.13
C.14
D.15
第5题:
以下程序的输出结果是
#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
第6题:
以下程序输出结果是 ______。 #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.无定值
第7题:
下列程序的执行结果是( )。 #inClude<iostream.h) #include(stdlib.h) class TestClass { public: int x,y; TestClass(){x=y=0;} TestClass(int a,int b){x=a;y=b;} void disp() { cout<<"x="<<x<<",y="<<y<<endl; } }; void main() {
A.x=2,y=2
B.x=2,y=3
C.x=3,y=2
D.x=3,y=3
第8题:
以下程序的输出的结果是( )。#include <iostream.h>int x=3;void main(){ void incre(); int i; for (i=1;i<x;i++) incre();}Void incre(){ static int x=1; x*=x+1; cout<<x<<"";}
A.3 3
B.2 2
C.2 6
D.2 5
第9题:
下列程序运行后的输出结果是( )。 #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
第10题:
下列程序运行后的输出结果是( )。 #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
第11题:
下面程序的输出结果是( )。#include<iostream.h>void main(){int x=-1,y=5,z;z=(x++<0)&& (y-->=0);cout<<x<<'\t'<<y<<'\t'<<z<<end1;}
A.-1 5 0
B.-1 4 1
C.0 4 1
D.0 4 0
第12题:
下列程序的输出结果是______。
include<iostream.h>
class base
{
int x,y;
public:
base(int i,int j){x=i;y=j;}
virtual int add( ){return x+y;}
};
class three:public base
{
int z;
public:
three(int i,int j,int k):base(i,j){z=k;)
int add( ){return(base::add( )+z);}
};
void main( )
{
three*q=new three(10,20,30);
cout<<q->add( )<<endl;
}
第13题:
以下程序的运行结果是( )。 #include<iostream.h> void sub(int x,int y,int*z) {*Z=y-x;} void main() {int a,b,c; sub(10,5,&a); sub(7,a,&b); sub(a,b,&c); cout<<a<<“,”<<b<<“,”<<c<<endl;}
A.5,2,3
B.-5,-12,-7
C.-5,-12,-17
D.5,-2,-7
第14题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第15题:
有以下程序: #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
第16题:
已知程序的结果为1 2 3,请填空。
include<iostream.h>
template<class T>
class A
{
public:
T X, y, z;
void display( ) {cout < < x < < " " < < y < < " " < < z;}
};
void main( )
{
A<int>a1;
_____
_____
_____
a1.display( ) ;
}
第17题:
下列程序段的输出结果是 #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
第18题:
以下程序的运行结果是 #include<iostream.h> void sub(int x,int y,int*z) { *z=y-x;} void main() { int a,b,c; sub(10,5,&a); sub(7,a,&b); sub(a,b,&c); cout << a <<","<< b<<"," << C << endl;}
A.5,2,3
B.-5,-12,-7
C.-5,-12,-17
D.5,-2,-7
第19题:
阅读下面程序:#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
第20题:
下列程序的运行结果是( )。 #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
第21题:
下列程序的运行结果是( )。 #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
第22题:
下列程序段的输出结果是 #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
第23题:
有以下程序 #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,2); cout << X < < ‘,’ < < y < < ‘,’ < < z < < endl; } 输出结果是
A.30,20,10
B.10,20,30
C.456,567,678
D.678,567,456