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

题目内容 (请给出正确答案)
下列程序中需要清理动态分配的数组,划线处应有的语句是_______。 include class pers

下列程序中需要清理动态分配的数组,划线处应有的语句是_______。

include<iostream.h>

class person

{

int age,tall;

public:

person( ){age=0;tall=40;cout<<"A baby is born."<<endl;}

person(int i){age=i;tall=40;cout<<"A old person."<<endl;}

person(int i,int j){age=i;tall=j;cout<<"a old person with tall."<<endl;)

~person( ){cout<<"person dead."<<endl;}

void show( )

{

cout<<"age="<<age<<",tall="<<tall<<endl;

}

};

void main( )

{

person*ptr;

ptr=new person[3];

ptr[0]=person( );

ptr[1]=person(18);

ptr[2]=person(20,120);

for(int i=0;i<3;i++)

ptr[i].show( );

______

}


参考答案

更多 “ 下列程序中需要清理动态分配的数组,划线处应有的语句是_______。 include class pers 下列程序中需要清理动态分配的数组,划线处应有的语句是_______。include<iostream.h>class person{int age,tall;public:person( ){age=0;tall=40;cout<<"A baby is born."<<endl;}person(int i){age=i;tall=40;cout<<"A old person."<<endl;}person(int i,int j){age=i;tall=j;cout<<"a old person with tall."<<endl;)~person( ){cout<<"person dead."<<endl;}void show( ){cout<<"age="<<age<<",tall="<<tall<<endl;}};void main( ){person*ptr;ptr=new person[3];ptr[0]=person( );ptr[1]=person(18);ptr[2]=person(20,120);for(int i=0;i<3;i++)ptr[i].show( );______} ” 相关考题
考题 下列程序中划线处正确的语句是()。 include using namespace std;class Base{public:v 下列程序中划线处正确的语句是( )。 # include <iostream> using namespace std; class Base { public: void fun(){cout<<"Base:: fun" <<endl;} }; class Derived:public Base { void fun() { ______ ∥显式调用基类的函数fun() cout<<"DA.fun();B.Base.fun();C.Base::fun();D.Base- >fun();

考题 下列程序完成从文件读取文件显示的同时写入第二个文件,则在程序中划线部分应该出现的语句是______。include<iostream.h>include(fstream.h)void main(){fstream filel,file2;charfnl[10],fn2[10],ch;cout<<“输入源文件名”;cin>>fnl;cout<<“输入目标文件名”;cin>>fn2;filel.open(fnl,ios::i

考题 下列程序不能通过编译,应该在划线部分填写的语句是【 】。includeinclude 下列程序不能通过编译,应该在划线部分填写的语句是【 】。include<iostream. h>include<stdlib. hdouble Fune(int a, int b, char ch){double x;switch(ch){case '+':x=double(a) +b;break;case '--':x= double(a) --b;break;case '/':x=double(a) * b;break;case '/':if(B) x=double(a) /b;elseexit(1)breakdefault:exit(1);}______}void main(){cout<<Func(32 , 6 ,'--')<< ",";cout<<Func(32, 6 ,'*') <<",";cout<<Func(32, 6 ,'/') <<end1;}

考题 以下函数按每行8个输出数组中的数据:下划线处应填入的语句是( )。A.B.C.D.

考题 下列程序中划线处正确的语句是()。include using namespace std;class Base{public:vo 下列程序中划线处正确的语句是( )。#include <iostream>using namespace std;class Base{public:void fun() { cout<<"Base:: fun"<<end1; }};class Derived: public Base{ void fun() { _______________________ //显试调用基类的函数 fun() cout <<"Derived:: fun"<<end1;};A.fun();B.Base. fun();C.Base:: fun();D.Base->fun();

考题 下列程序编译错误,是由于划线处缺少某个语句,该语句是______。 include class A { pr 下列程序编译错误,是由于划线处缺少某个语句,该语句是______。include<iostream.h>class A{private:int numl;public:A( ):numl(0){}A(int i):numl(i){}};class B{private:int num2;public:B( ):num2(0){}B(int i):num2(i){}int my_math(A obj1, B obj2);};int B::my_math(A obj1,B obj2){return(obj1.numl+obj2.num2);}void main(void){A objl(4);B obj,obj2(5);cout<<"obj1+obj2:"<<obj.my_math(obj1,obj2);}

考题 在下列的程序的横线处填上适当的语句,使该程序的输出为12。include using namespace 在下列的程序的横线处填上适当的语句,使该程序的输出为12。include<iostream.h>using namespace std;class Base{public:int a,b;Base(int i){a=i;}};class Derived:public Base{int a;public:Derived(int x):Base(x),b(x+1){};void show(){

考题 下列程序不能通过编译,应该在划线部分填写的语句是______。 include include 下列程序不能通过编译,应该在划线部分填写的语句是______。include<iostream.h>include<stdlib.h>double Func(int a,int b,char ch){double x;switch(ch){case'+':x=double(a)+b;break;case '-':x=double(a)-b;break;case '*':x=double(a)*b;break;case'/':if(B)x=double(a)/b;elseexit(1);break;default:exit(1);}______}void main( ){cout<<Func(32,6,'-')<<",";cout<<Func(32,6, '*')<<",";cout<<Func(32,6,'/')<<endl;}

考题 按解释中的要求在下列程序划线处填入的正确语句是:() #include <iostream.h> class Base{ public: void fun() {cout<<"Base::fun"<<endl;} }; class Derived:public Base{ public: void fun() { _______________________//在此空格处调用基类的函数fun() cout<<"Derived::fun"<<endl;} };A.fun();B.Base.fun();C.Base::fun();D.Base->fun();