首页/ 题库 / [单选题]

考虑下面的函数:
int的答案

考虑下面的函数:
int min(int x,int y){return xint max(int x,int y){return x>y?x:y;}
对于下面的代码:
t=0;
for(i=max(x,y);i>=min(x,y);i--)
t+=i;
假设x=1,y=100,则可以得到函数调用的次数为()

单选题
2022-03-15 18:06
A、200
B、201
C、101
D、102
查看答案

正确答案
D

试题解析

感兴趣题目

考虑下面的函数:
int min(int x,int y){return xint max(int x,int y){return x>y?x:y;}
对于下面的代码:
t=0;
for(i=max(x,y);i>=min(x,y);i--)
t+=i;
假设x=1,y=100,则可以得到函数调用的次数为()

有说明语句int x[4][5];void fun(int y[4][5] ,int m,int n);调用函数的正确语句是()
有说明语句int a[10];及函数int fun(int x[10],int n){return sizeof(x);},则语句cout<<><>
若一个函数的原型为“int* funl(int x,int& y,char z);”,则该函数的返回值类型为(  )。
有以下函数 int fun(char*X,char*y) { int n=0; while((*x= = =*y)*x!=O){x++; y++; n++;} return n; } 函数的功能是( )。
有以下程序int f1(int x, int y){ return x>y? x:y;}int f2(int x, int y){ return x>y? y:x;}main(){ int a=4,b=3,c=5,d,e,f; d=f1(a,B) ;d=f1(d,C) ; e=f2(a,B) ;e=f2(e,C) ; f=a+b+c-d-e; cout<<d<<", "<<f<<", "<<e<<end1;}执行后输出结果是
下面的函数声明中,()是“void BC(int a, int b);”的重载函数
有如下函数定义;void func(int a,int & b){a++;b++;}若执行代码段:int x=0,y=1;func(x,y);则变量x和y的值分别是
函数定义如下: void fun(int x,int& y){x++;y++;} 如果执行代码段: int a=0,b=1; fun(a,b); 则变量a和b的值分别是( )。
以下程序执行后的输出结果是( )。 #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; }
以下程序执行后的输出结果是 #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; }
运行下面的程序时,会产生( )。 public class Test{ public static void main(String args[ ] ) { int x =0; int y = 2/x; int z[ ] = {1,2,4,6}; int p=z[4]; } }
相关题目
若 x 和y 都是 int 型变量,x=100, y=200,且有下面的程序片段:
printf("%d",(x,y));
上面程序片段的输出结果是
考虑函数原型void test(int a,int b=7,char=’’),下面的函数调用中,属于不合法调用的是
有如下程序  int func(int a, int b)  { return(a+b); }  main()  {int x=2, y=5, z=8, r;   r=func(func(x, y), z);printf("%d\n", r);}
下面是类MyClass的定义,对定义中各语句描述正确的是( )。 class MyClass { private: int x,y, z; public: void MyClass(int A) { x=a; } //① int f(int a, int B) //② { x=a; y=b; } int f(int a,
有如下类说明: class TestClass{ int x; public: TestClass(int n){x=n;} }; class TestClass1:public TestClass{ int y; public: TestClass1(int a,int b); }; 在构造函数TestClass1的下列定义中,正确的是( )。
有如下类声明: class XA { int x; public: XA(int n){x=n;} }; class XB:public XA { int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是
有如下类声明: class XA{ int X; public: XA(int n){x=n;} }; class XB:public XA{ int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是( )。
有如下类声明: class XA{ int X; public: XA(int n){x=n;} }; class XB:publicXA{ int y; public: XB(int a,int b); ); 在构造函数XB的下列定义中,正确的是( )。
有如下类声明: class XA{ int x; public: XA(int n){x=n;} }; class XB:public XA{ int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是( )。
下列函数的运行结果是( )。 #include<iostream.h> int add(int a,int b); void main() { extern int x,y; cout<<add(x,y)(<endl; ) int x(20),y(5); int add(int a,intB) { int s=a+b; return s; }
设某程序中定义了全局整型变量x和r,且函数f()的定义如下所示,则在语句“x= r*r+1”中(49)。 int f(int r){ int x; X= r*r+1 ; return x; }
有如下函数定义: void funC(int a,int&B. {a++;b++;} 若执行代码段: int x=0,Y = 1; funC(X,Y); 则变量x和y的值分别是( )。
以下程序执行后的输出结果是 #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; }
以下程序执行后的输出结果是( )。 #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; }
若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int B) { x=a; y=b; } int getx() { return x; } int gety() { reurn y; } }; class Circle: public Point { private: int r; public: Circle(int a,int b.int C) :Point(a,B) r=c; int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle cl(5,7,10); cout<<c 1 .area()<<end1; return 0; } 程序执行后的输出结果是
若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a, int b,int c) :Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。
若有程序fun(int a, int b){ static int c=0; c+=a+ b; returm c;}main(){ int x=5,y=3,z=7,r; r=fun((y, x+ y),z); r=fun (x, y); printf("%d ", r);}
当下面的程序运行后,变量c的值为______。 main () { int a=45, b=27, c=0; c=max (a, b); } int max (x, y) int x,y; { int z; if (x>y) z=x; else z=y; return(z); }
有如下程序 int func(int a,int b) { return(a+b); } main() { int x=2,y=5,z=8,r; r=func(func(x,y),z); printf("%d/n",r); } 该程序的输出结果是()
有以下程序#includeint fun(int a,int b){ return a+b;}main(){ int x = 6,y=7,z = 8,r; r = fun(fun(x,y),z--); printf(%d,r);}程序运行后的输出结果是(  )。
广告位招租WX:84302438

免费的网站请分享给朋友吧