对下列程序的描述中,正确的是( )。 #include<iostream> using namespace std; int Fun(int,int); int main() { cout<<Fun(5,50)<<end1; return 0; } int Fun(int x,int y) { return x*x+y*y; }
A.该函数定义正确,但函数调用方式错误
B.该函数调用方式正确,但函数定义错误
C.该函数的定义和调用方式都是正确的
D.该函数的定义和调用方式都是错误的
第1题:
如下程序的输出结果是______。
include<iostream>
using namespace std;
int funl(int x){return++x;}
int fun2(int&x){return++x;}
int main( ){
int x:1,y=2;
Y=funl(fun2(x));
cout<<x<<','<<y;
return 0;
}
第2题:
有以下程序:
include <iostream>
using namespace std;
const xnt N=5;
int fun(char *s,char a,int n)
{
int j;
*s=a;j=n;
while(a<s[j])
j--;
return j;
}
int main()
{
char s[N+1];
int k;
第3题:
有如下程序 #include <iostream> using namespace std; int i=1; class Fun { public: static int i; int value( ){ return i-l;} int value( )const { return i+1;} }; int Fun::i=2; int main( ){ int i=3; Fun funl; const Fun fun2; ___________ return 0; } 若程序的输出结果是: 123 则程序中下划线处遗漏的语句是
A.cout<<funl.value( )<<Fun::i<<fun2.value( );
B.cout<<Fun::i<<funl.value()<<fun2.value( );
C.cout<<funl.value( )<<fun2.value( )<<Fun::i;
D.cout<<fun2.value( )<<Fun::i<<fun1.value( );
第4题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
第5题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
void fun()
{
static int a=0;
a+=2;
cout<<a;
}
int main()
{
int CC;
for(CC=1;cc<4;CC++)
fun();
cout<<end1;
return 0;
}
第6题:
有如下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun (n-2)); else return 2; } int main() { cout<<fun(3)<<end1; return 0; } 则该程序的输出结果应该是 ( )。
A.2
B.3
C.4
D.5
第7题:
下面程序的输出结果是【 】。
include <iostream>
using namespace std;
int d=1;
fun(int p){
static int d = 5;
d+ =p;
cout<<d;
return (d) ;
}
void main ( ) {
int a =3;
cout<<fun ( a + fun (d) )<<endl;
}
第8题:
如有下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun(n-2)); else return 2; } int main() { cout<<fun(3)<<endl; return 0; } 则该程序的输出结果应该是( )。
A.2
B.3
C.
D.5
第9题:
阅读下面程序:
include <iostream>
using namespace std;
int fun( int a, int b)
{
int c;
c = a * b;
return c;
}
int main ( )
{
int a = 3, b = 5, c = 4, x = O;
x = fun( fun( a, b ), c );
cout<<x<<end1;
return 0;
}
其运行结果是【 】。
第10题:
有以下程序: #include <iostream> using namespace Std; int a; int fun(); int main() { extern int a; int b; a = 100; b = fun(); cout<<b<<end1; return 0; } int fun() { extern int a; return (10*A); } 其程序运行后的输出结果是( )。
A.100
B.10
C.1000
D.10000