7 1
4 3
3 4
0 0
第1题:
阅读下列程序:
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);
}
则该程序的输出结果是______。
第2题:
有如下程序: #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::ndl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第3题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第4题:
有如下程序: #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
第5题:
有以下程序: #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
第6题:
执行以下程序后的输出结果为 ( )。#include<iostream>Using namespace std;void fun(int x, int y, int *cp, int *dp) {*cp=x+ y; 2*dp=x- y;}void maia() {int a, b, c, d; a=30; b=50; fun(a, b, &c, &d); cout<<c<<','<,d<<end1;}
A.50, 30
B.30, 50
C.80, 20
D.80, 20
第7题:
以下程序输出结果是 ______。 #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.无定值
第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> 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
第11题:
有以下程序: #include <stdio.h> void fun(int a,int b,int c) { a=456,b=567,c=678;} main() { int x=10,y=20,z=30; fun(x,y,z); printf("%d,%d,%d\n",x,y,z); } 此程序的输出结果是( )。
A.30,20,10
B.10,20,30
C.456,567,678
D.678,567,456
第12题:
有以下程序 #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
第13题:
以下程序运行后的输出结果是【 】。
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;}
第14题:
下面程序的运行结果是______。
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;
}
第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
第16题:
有以下程序: #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
第17题:
有以下程序 #include<stdio.h> void fun(int*a,int*B) { int*c; c=a;a=b;b=c; } main() { int x=3, y=5,*p=&x, *q=&y; fun(p,q); printf("%d,%d,",*p,*q); fun(&x,&y); printf(" %d,%d\n",*p,*q); } 程序运行后的输出结果是______。
A.3,5,5,3
B.3,5,3,5
C.5,3,3,5
D.5,3,5,3
第18题:
下列程序段的输出结果是 #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
第19题:
请填写空格:
include<iostream>
using namespace std;
void fun(int x,int y,int * z)
{ *2 = x + y;}
void main()
{
int a=100,b=100,c,*p=&c;
fun(a,b,p);
【 】; //输出调用fun函数后返回a、b的和。
}
第20题:
有以下程序: #include<iostream.h> void fun(int a,mt 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
第21题:
下列程序运行后的输出结果是( )。 #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
第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<<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
第23题:
下列程序段的输出结果是 #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
第24题:
以下正确的函数原型为()