填空题
在下面函数的横线处填上适当的内容使该函数能够利用递归方法求解字符串str的长度(不得使用系统提供的字符串处理函数)。 int GetLen(char *str { if (
【6】
) return
【17】
; else return 1+GetLen (str+1); }
【参考答案】
[6] *str==NULL 或者!*str
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
问题处理方案的正确而完整的描述称为 【5】 。
点击查看答案&解析
单项选择题
有如下的程序; #include <ctring> #include <iostream> using namespace std; class MyString { public: MyString(const char *s); ~MyString() {delete []data;} protected: unsigned len; char *data; }; MyString:: MyString (const char *s) { len=strlen(s); data=new char[len+1]; strcpy(data,s); } int main() { MyString a( C++ Programing ); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是______ 。
A.构造函数的实参不允许是本类的对象
B.没有定义实现深层复制(深拷贝)的拷贝构造函数
C.构造对象a时实参与形参类型不符
D.系统不能生成缺省的拷贝构造函数
点击查看答案&解析
相关试题
以下函数模板max 的功能是返回数组a中最大...
下面程序的执行结果是 【15】 。#incl...
Staff类含有血型数据成员ID,两个Staff 对...
在下面程序的横线处填上适当的内容,使程序...
在下向程序和横线处填上适当的内容,使程序...