设void f1(int*,long &);int a[]={1,2,3};long b;,则以下调用合法的是______ 。A.f1 (a,b):B.
设void f1(int*,long &);int a[]={1,2,3};long b;,则以下调用合法的是______ 。
A.f1 (a,b):
B.f1(&a,b);
C.fl(a,&b);
D.f1 (&a,&b):
时间:2023-08-14 15:48:03
-
6.下面程序的输出结果是#include long func(int n);int main(void){printf(\%ld\, func(5));return 0;}long func(int n){if (n > 2) { return func(n-1) + func(n-2); }else { return 1; }}
-
有以下程序void fun(int n,int *p){ int f1,f2;if(n==1||n==2) *p=1;else{ fun(n-1,&f1);fun(n-2,&f2);*p=f1+f2;}}main( ){ int s;fun(3,&s);printf(\%d\\n\,s);}程序的运行结果是( ).
-
下面程序的运行结果为include<iostream.h>void swap(int &a, int b){int temp;temp=a++;a=b;b=temp;}void main()int a=2,b=3;swap(a, b) ;cout < < a < <"," < < b < < endl;}
A.2,3
B.3,2
C.2,2
D.3,3
-
以下程序的输出结果是include <stdio.h>void prt (int *x, int*y, int*z){printf("%d,%d,%d\n",++*x,++*y,*(z++));}main(){int a=10,b=40,c=20;prt (&a,&b,&c);prt (&a,&b,&c);}
A.11,42, 31 12,22,41
B.11,41,20 12,42,20
C.11,21,40 11,21,21
D.11,41,21 12,42,22
-
已知函数f的原型是:void f(int*a,long &b);,变量v1、v2;的定义是int v1;long v2;正确,的调用
已知函数f的原型是:void f(int*a,long &b);,变量v1、v2;的定义是int v1;long v2;正确,的调用语句是
A.f(v1,& v2);
B.f(v1,v2);
C.f(& v1,v2);
D.f(&v1,&v2);
-
下面程序的运行结果是include<iostream.h>void main(){int num=1;int &ref=num;ref=ref+2;c
下面程序的运行结果是 include<iostream.h> void main() { int num=1; int &ref=num; ref=ref+2; cout<<num; num=num+3; cout<<ref<<end1; }
A.13
B.16
C.36
D.33
-
有以下程序:int sub(int n) { return(n/10+n%10); }void main(){ int x,y; scanf("%d",&x);
有以下程序:int sub(int n) { return(n/10+n%10); }void main(){ int x,y; scanf("%d",&x); y=sub(sub(sub(x))); printf("%d\n",y);}若运行时输入:4321<回车>,程序的输出结果是。
-
下列程序的执行结果为include<iostream.h>void main(){ int a=3,b=0; int * p=&a; b=+a++;
下列程序的执行结果为 include<iostream.h> void main() { int a=3,b=0; int * p=&a; b=+a++; cout<<*p<<','<<b<<end1; }
A.3,4
B.4,3
C.3,4
D.4,4
-
下面程序的运行结果为()。 include<iostream.h> void swap(int &a,int B) { int temp; temp=a++; a=b; b=temp; } void main() { int a=2,b=3; swap(a,b); cout<<a<<“,”<<b<<end1; }
A.2,3
B.3,2
C.2,2
D.3,3
-
执行下列程序段,结果是 include<iostream.h> void main() { int x=40; char y='C'; int n; n=(x&0xff)&&(y>'B'); cout<<n;}
A.0
B.1
C.2
D.3
-
以下程序段的输出结果是[ ]。 include<iostream.h> void ref(int &i); void main(){int val=1
以下程序段的输出结果是 [ ] 。
include<iostream.h>
void ref(int &i);
void main(){
int val=1;
cout<<“旧值:”<<val<<end1;
ref(val);
cout<<”新值:”<<val<<end1;
}
void ref(int &i){i=10;}
-
下面程序的运行结果是()。include<iostream.h> void main{int num=1:int&ref=num; ref
下面程序的运行结果是()。
include<iostream.h> void main
{
int num=1:
int&ref=num; ref=ref+2:
cout<<num: num=num+3: cout<<ref<<endl:
}
A.13
B.16
C.36
D.33
-
下面程序的运行结果是 include<iostream.h> void fun(int * a,int * b) { int x= * a; * a = * b; * b=x; cout <<*a<< *b<<""; } void main(0 { int x =1,y =2; fun(&x,&y); cout<< x << y <<end1; }
A.12 12
B.12 21
C.21 12
D.21 21
-
下列程序的执行结果为()。include<iostream.h>void main{int a=3,b=0;int*P =&a;b=+a+
下列程序的执行结果为()。
include<iostream.h>
void main
{
int a=3,b=0;
int*P =&a;
b=+a++;
cout<<*P<<”,”<<b<<endl;
}
A.3,4
B.4,3
C.3,4
D.4,4
-
下面程序的运行结果是【】。 include<iostream> using namespace std; void fun(int&a,int b=3)
下面程序的运行结果是【 】。
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;
}
-
在下面程序运行后,输出结果为 ______。include<iostream.h>void count(int x[],int n,int &y
在下面程序运行后,输出结果为 ______。 include<iostream.h> void count(int x[],int n,int &y){ int k; y=0; for(k=0:k<n;k++) if(x[k]<0) y++; } void main(){ int b[]={2,1,-8,-3,7,2,4,6,0,-13}; int x; count(b,10,x); cout<<“x”<<x<<end1; }
A.x=3
B.x=5
C.出错
D.x=0
-
有以下程序:void f(int y,int *x){y=y+ *x; *x;=*x+y;}main(){int x=2,y=4;f(y,&x);-printf
有以下程序: void f(int y,int *x) { y=y+ *x; *x;=*x+y;} main() { int x=2,y=4; f(y,&x); - printf ("%d %d\n",x,y); } 执行后的输出结果是 ______。
A.8 4
B.8 8
C.4 8
D.4 2
-
下面程序的运行结果为include<iostream,h>Void swap(int &a,int b){int temp;temp=a++;a=b;
下面程序的运行结果为 include<iostream,h> Void swap(int &a,int b) { int temp; temp=a++; a=b; b=temp; } void main() { int a=2,b=3; swap(a,b); cout <<a <<”,” <<b <<end1 }
A.2,3
B.3,2
C.2,2
D.3,3
-
已知函数f的原型是:void f(int *a,long &b);,变量v1、v2的定义是:int v1;long v2;,正确的调用语句
已知函数f的原型是:void f(int *a,long &b);,变量v1、v2的定义是:int v1;long v2;,正确的调用语句是______。
A.f(v1,& v2);
B.f(v1,v2);
C.f(&v1,v2);
D.f(&v1,&v2);
-
若有以下类W说明,则函数fConst的正确定义是()。class W { int a;public: void fConst(int& ) const;};
A.void W::fConst(int& k ) const { k = a;}
B.void W::fConst(int& k ) const { k = a++;}
C.void W::fConst(int& k ) const { cin>> a;}
D.void W::fConst(int& k ) const { a = k;}
-
有如下函数定义void fun(int &);则如下调用中,正确的是()
A.int a=100; fun(&a)
B.fun(256)
C.int a=100; fun(a)
D.int a=100; fun(3*a)
-
void funB(int a1, int &b1, int* &c1, const int a2, const int &b2, const int *c
void funB(int a1, int &b1, int* &c1, const int a2, const int &b2, const int *c2) { a1++; //s1 b1++; //s2 *c1 = *c1 + 1; //s3 b2++; //s4 *c2 = *c2 + 1; //s5 a2++; //s6 } 上述代码段中,无法正确编译执行的语句有()
A、s1
B、s2
C、s3
D、s4
E、s5
F、s6
-
下面程序运行的结果为() include <stdio.h> int *fun(int *px, int *py); int *fun(int *px, int *py) { return (*px > *py? px : py); } void main() { int a=5,b=8; int *p1=fun(&a,&b),*p2=fun(&b,&a); printf("%d-%d\n", *p1 , *p2 ); }
A.5-8
B.8-5
C.8-8
D.5-5
-
下列程序的输出结果是()。includevoid p(int*x){ printf("%d ¨, ++*x);}void main(){ int y=3;p(&y);}
A.3
B.4
C.2
D.5