有以下程序 #include<iostream.h> floatfun(int x,int y) {return(x+y);} void main() {int a=2,b=5,c=8; tout<<fun((int)fun(a+c,b),a-C);} 程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9
第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 x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第3题:
有如下程序: #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
第4题:
有以下程序: #include<stdio.h> float fun(int x,int y) { return(x+y); } main() { int a=2,b=5,c=8; printf("%3.0f\n",fun((int)fun(a+c,b),a-c)); } 程序运行后的输出结果是( )。
A.编译出错
B.9
C.21
D.9
第5题:
有以下程序:
include <iostream>
using namespace std;
void t(int x,int y, int cp,int dp)
{
cp=x*x+y+y;
dp=x*x-y*y;
}
int main()
{
int a=4,b=3,c=5,d=6;
t(a,b,c,D) ;
cout<<c<<","<<d<<end1;
return 0;
第6题:
有以下程序: #include<stdio.h> int fun(int x,int y) {if(x==y)return(x); else return((x+y)/2); } main() {int a=1,b=2,c=3; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。
A.2
B.3
C.4
D.5
第7题:
以下程序的执行结果是 ______。
include<iostream.h>
int &max(int &x,int &y)
{
return(x>y? x:y);
}
void main()
{
int n=2,m=10;
max(n,m)--;
cout<<"n="<<n<<",m="<<m<<endl;
}
第8题:
下面程序的输出结果是【 】。
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;
}
第9题:
有以下程序 #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
第10题:
阅读下面程序: #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<<endl; } 则该程序的输出结果是( )。
A.11
B.20
C.21
D.31
第11题:
以下程序执行后的输出结果是( )。 #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.不确定
第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>
int f (int x, int y){
return x,y;
}
double f (double x, double y) {
return x,y;
}
void main() {
int a=4, b=6;
double c=2.6, d=7.4;
cout<<f (a, b) <<","<<f (c, d) <<end1;
}
第14题:
有以下程序 #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
第15题:
有以下程序: #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
第16题:
有以下程序 #include<stdio.h> int fun(int x;int y) { if(x=y)reurn(x); else return((x+y)/2); } main() { int a=4,b=5,c=6; printf("%d\n",fun(2*a,fun(b,c))); } 程序运行后的输出结果是______。
A.3
B.6
C.8
D.12
第17题:
有以下程序: #include<stdioh> int fun(int x,int y) {if(x!=y)return(y); else return((x+y)/2); } main() {int a=4,b=5,c=6; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。
A.3
B.6
C.8
D.12
第18题:
以下程序输出结果是 ______。 #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.无定值
第19题:
以下程序的输出结果是【 】。
include<iostream.h>
int add(int x,int y)
{
retum X+y;
}
dOuble add(dOUble x,double y)
{
return x+y;
}
void main()
{
int a=4,b=6;
double c=2.6,d=7.4;
cout<<add(a,b)<<",”<<add(C,d)<<endl;
}
第20题:
阅读下面程序:#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
第21题:
以下程序执行后的输出结果是 #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.不确定
第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 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.不确定