Func(ref(10*a))
Func(ref 10)
Func(ref(a) )
Func(ref a)
第1题:
以下程序的执行结果是______
include<iostream.h>
void func(int);
void main()
{
int k=4
func(k) ;
func(k) :
cout<<end1;
}
void func(int a)
{
static int m=0;
m+=a;
cout<<m<<" ";
}
第2题:
下列函数的功能是【 】。
include<iostream. h>
int Func(int a,int b)
{
if (a>b) return 1;
else if(a==b) return 0;
else return -1;
}
第3题:
下列程序执行后的输出结果是
void func1(int i);
void func2(int i);
char st[]="hello,friend!";
void func1(int i)
{ printf("%c",st[i]);
if(i<3){i+=2;func2(i);}}
void func2(int i)
{ printf("%c",st[i]);
if(i<3){i+=2;func1(i);}}
main()
{ int i=0; func1(i); printf("\n");}
A.hello
B.hel
C.hlo
D.hlm
第4题:
A. fun(v1,&v2);
B.fun(v1,v2);
C.fun(&v1,v2);
D.fun(&v1,&v2);
第5题:
类clasg one在声明func成员函数时发生错误,出错原因是______。
class one
private:
int a;
public:
void func(two&);
};
class two
{
private:
int b;
friend vold one::func(two&);
};
void one::func(two&r)
{
a=r.b;
}
第6题:
( 21 )有如下函数定义:
void func ( int a,int & b ) {a++; b++;}
若执行代码段:
int x=0 ,y=1
func ( x,y ) ;
则变量 x 和 y 值分别是
A ) 0 和 1
B ) 1 和 1
C ) 0 和 2
D ) 1 和 2
第7题:
对下列程序段的描述正确的是( )。 #include<iostream.h> int Fun(int,int) void main() { cout<<Fun(5,50)<<endl; } int Fun(int x,int y) { return X*X+y*y; }
A.该函数定义正确,但函数调用方式错误
B.该函数调用方式正确,但函数定义错误
C.该函数定义和调用方式都正确
D.该函数定义和调用方式都错误
第8题:
以下程序段的输出结果是 [ ] 。
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;}
第9题:
下列程序执行后的输出结果是______。
A.hello
B.hel
C.hlo
D.hlm void func1 (int i); void func2 (int i); char st[]="hello,friend!"; void func1(int i) { printf("%c",st[i]); if(i<3){ i+=2;func2(i); } } void func2 (int i) { printf("%c",st[i]); if(i<3){ i+=2;func1(i); } } main() { int i=0;func1(i);printf("\n");}
第10题:
下列程序执行后的输出结果是 void funcl(int i); void func2(int i); char st[]="hello,friend!"; void funcl(int i) {printf("%c",st[i]); if(i<3){i+=2;func2(i);}} void func2(int i) { printf("%c",st[i]); if(i<3){i+=2;func1(i);}} main() {int i=
A.hello
B.hel
C.hlo
D.hlm