网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下面代码有何错误

void func2(int *value)

{

*value = 2;

}

void func1()

{

int *p = 0;

func2(p);

}


参考答案

更多 “ 下面代码有何错误void func2(int *value){*value = 2;}void func1(){int *p = 0;func2(p);} ” 相关考题
考题 下列程序执行后的输出结果是void func1(int i);void func2(int i);char st[]="hello,friend!";void func1(int i){ printf("%c",st[i]);if(i3){i+=2;func2(i);}}void func2(int i){ printf("%c",st[i]);if(i3){i+=2;func1(i);}}main(){ int i=0; func1(i); printf("\n");}A.helloB.helC.hloD.hlm

考题 有如下程序#includeusing namespace std;class A{public:virtual Void funcl(){cout “A1”;}void fune2(){cout “A2”;}};class B: public A{public:void func1(){cout “B1”;}void func2(){cout “B2”;}};Int main(){A*p=new B;p-funcl();p-func2();retum0;}运行程序,屏幕上将显示输出______。A.B1B2B.A1A2C.B1A2D.A1B2

考题 ( 35 ) 有如下程序#includeusing namespace std;class A{public:virtual void func1( ){ cout"A1"; }void func2( ){ cout"A2"; }};class B:public A{public:void func1( ){ cout"B1"; }void func2( ){ cout"B2"; }};int main( ){A *p=new B;p-func1( );p-func2( );return 0;}运行此程序 , 屏幕上将显示输出A) B1B2B) A1A2C) B1A2D) A1B2

考题 下面程序错误的语句是①include ②void main( 0③{④int * p = new int[1] ;⑤p =9;⑥co 下面程序错误的语句是 ①#include < iostream.h> ②void main( 0 ③{ ④ int * p = new int[1] ; ⑤ p =9; ⑥ cout <<*p <<end1; ⑦ delete [ ] p; ⑧ }A.④B.⑤C.⑥D.⑦

考题 下列程序执行后的输出结果是void funcl(int i);void func2(int i);char st[]="hello,friend!";void fund(int i){ cout<<st[i];if(i<3){i+=2;func2(i);}}void func2(int i){ cout<<st[i];if(i<3){i+=2;funcl(i);}}main( ){int i=0;fund(i);cout<<endl;}A.helloB.helC.hloD.hlm

考题 有如下程序include using namespace std;class A{public:virtual void func1 (){ cou 有如下程序#include <iostream>using namespace std;class A{public:virtual void func1 (){ cout<<"A1"; }void func2(){ cout<<"A2"; }};class B: public A{public:void func l(){ cout<<"B1"; }void func2(){ cout<<"B2"; }};int main() {A *p=new B;p->func1();p->func2();return 0;}运行此程序,屏幕上将显示输出( )。A.B1B2B.A1A2C.B1A2D.A1B2

考题 下列程序执行后的输出结果是______。A.helloB.helC.hloD.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");}

考题 下列程序执行后的输出结果是 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.helloB.helC.hloD.hlm

考题 写出下列代码的输出内容#includeint inc(int a){return(++a);}int multi(int*a,int*b,int*c){return(*c=*a**b);}typedef int(FUNC1)(int in);typedef int(FUNC2)(int*,int*,int*);void show(FUNC2 fun,int arg1, int*arg2){INCp=inc;int temp =p(arg1);fun(temp,arg1, arg2);printf("%d\n",*arg2);}main(){int a;show(multi,10,a);return 0;}

考题 有如下程序void func1(int st[],int i){ printf("%c",st[i]); if(i}void func2(int st[],int i){ printf("%c",st[i]); if(i}main(){ char st[ ]="hello,friend! "; int i=0;func1(st,i); printf("\n");}程序执行后输出的结果是A.hello B.hel C.hlo D.编译出错

考题 下列程序执行后的输出结果是()。includevoid func1(int i);void func2(int i);char st[ 下列程序执行后的输出结果是( )。 #include<stdio.h> void func1(int i); void func2(int i); char st[]="hello,friend!"; void funcl(int i) { printf("%c",st[i]); if(i<3){i+=2;func 2(i);} } void func 2(int i) { printf("%c",st[i]); if(i<3){i+=2;funcl(i);} } main() { int i=0; funcl(i);printf("\n"); }A.helloB.helC.hloD.hlm

考题 下面程序执行后的结果是()。includeusing namespace std;void func1(int i);void func 下面程序执行后的结果是( )。 #include<iostream> using namespace std; void func1(int i); void func2(int i); char st[]="hello, friend!"; void func1(int i) { cout<<st[i]; if(i<3){i+=2;func2(i);} } void func2(int i) { cout<<st[i]; if(i<3){i+=2;func1(i);} } void main() { int i=0;func1(i);cout<<endl;}A.elloB.helC.hloD.him

考题 下列程序执行后的输出结果是( )。 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);}A.helloB.helC.holD.hlm

考题 下面代码有何错误void func1(){int *pa = NULL;func2(pa);delete pa;}void func2(int *pb){pb = new int(5);}

考题 int func1(int b){return 0;}void func2(){int bbb = 3;func1(bbb);func1(bbb);}func2中有何错误,func1的参数b 的类型是什么。

考题 有如下程序:includeusing namespace std;class A{public:virtual void func1(){cout 有如下程序: #include<iostream> using namespace std; class A{ public: virtual void func1(){cout<<"A1";} void func2(){cout<<"A2";} }; class B:public A{ public: void func1(){cout<<"B1";} void func2(){cout<<"B2";} }; int main() { A *p=new B; p->func1(); p->func2(); return 0; } 执行该程序,屏幕上将显示输出( )。A.B1B2B.A1A2C.B1A2D.A1B2

考题 有下列程序void func1(int i);void func2(int i);char st[ ]="hello,friend! ";void func1(int i){ printf("%c",st[i]); if(i3){i+=2;func2(i);}}void func2(int i){ printf("%c",st[i]); if(i3){i+=2;func1(i);}}main(){ int i=0;func1(i); printf("\n");}执行后的输出结果是A.hello B.helC.hlo D.hlm

考题 下列程序 void func1(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;funcl(i);} } main() { int i=0;funcl(i);printf("\n");} 执行后的输出结果是( )A.helloB.helC.hloD.hlrn

考题 下面类的定义,有( )处错误。 class MyClass { public: void MyClass(); ~MyClass(int Value); private: int i=0; };A.1B.2C.3D.4

考题 对于类定义 class A{ public: virtual void func1( ){} void func2( ){} }; class B:public A{ public: void func1( ){cout<<"class B func 1"< < end1;} virtual void func2( ){cout << "class B func2"<< end1;} }; 下面正确的A.A::func2( )和B::func1( )都是虚函数B.A::func2( )和B::func1( )都不是虚函数C.B::func1( )是虚函数,而A::func2( )不是虚函数D.B::func1( )不是虚函数,而A::func2( )是虚函数

考题 有下列程序:inCludeusing namespace std;c1ass A{pubic:virmal void func1(){cout 有下列程序: #inClude<iostream> using namespace std; c1ass A{ pubic: virmal void func1(){cout<<"A1";} void func2(){cout<<"A2";} }; c1ass B:public A{ publIc: void func1(){cout<<"B1";} void func2(){cout<<"B2"A.B182B.A1A2C.B1A2D.A182

考题 下列程序的运行结果是( )。 #includeiostream.h class Loeation{ private: int X,Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX{returnx;} void valueY(int val){Y=val;} int valueY{return Y;}}; void Location::init(int initX,int initY) {X=initX; Y=initY4} void main(X {Location A,B; A.init; B.value X(5); coutA.value XendlA.value Yendl; B.init(6,2); B.value Y(4); eoutB.value XendlB.value Yendl; }A.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2

考题 有如下程序:includeusing namespace std;class Base{public:virtual void func1(){co 有如下程序: #include<iostream> using namespace std; class Base{ public: virtual void func1(){cout<<"Base 1";} void rune2(){cout<<"Base 2";} }; class Derived:public Base{ public: void func1(){cout<<"Derived 1";} void func2(){cout<<"Derived 2";} }; int main(){ Base *p=new Derived; P->func1(); P->func2(); return 0: } 运行此程序,屏幕上将显示输出______。A.Derived 1 Base 2B.Base 1 Base 2C.Derived 1 Derived 2D.Base 1 Derived 2

考题 有如下程序: #includeiostream using namespace std; class A{ public: virtual void fancl{cout”Al”;} void func2{cout”A2”;} }; class B:public A{ public: void funcI{tout”Bl”;} void func2{tout”B2”;} }; intmain} A*P=new B: P—funcl; P—func2; delete p; return 0; } 执行这个程序的输出结果是( )。A.B182B.A1A2C.B1A2D.AIB2

考题 对于类定义 class A { public: virtual void funcl(){} void func2(){} }; class D:public A{ public: void funcl(){cout<< "class B rune 1"<<end1;} virtual void func2(){cout<< "class B func 2"<<end1;} }; 下面正确的叙述是 ______。A.A::func2()和B::funcl()都是虚函数B.A::func2()和B::funcl()都不是虚函数C.B::func1()是虚函数,而A::func2()不是虚函数D.B::func1()不是虚函数,而A::func2()是虚函数

考题 对于类定义: class A{ public: virtual void func1(){} Void func2 (){} }; class B:public A{ public: void func1(){cout<<"class B func 1"<<end1;} virtual void func2(){cout<<"class B func 2"<<end1;} };下面叙述正确的是( )。A.A::func2()和B::func1()都是虚函数 B.A::func2()和B::func1()都不是虚函数 C.B::func1()是虚函数,而A::func2()不是虚函数 D.B::func1()不是虚函数,而A::func2()是虚函数

考题 Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  A、Definition a.B、Definition b.C、Definition c.D、Definition d.E、Definition e.