AAAbloom 2016-11-03 12:09 采纳率: 0%
浏览 863

求解这个简单c++作业,嗯有很多错!

include
#include
class MString{
char *s;
int len;
public:
MStirng();
MString(char *ps);
MString(const MString &t);//copy funcation
~MString();
int size();
void swap(MString &t);
void find(char);
void find(MString &t);
MString &strcats(MString& t);
MString &strcpys(MString& t);
};
MString& MString::strcats(MString& t){
char *p;
p=new char[len+t.len+1];
strcpy(p,s);
strcat(p,t.s);
delete[]s;
s=p;
len+=t.len;
return *this;}
MString& Mstring::strcpys(MString& t){
s[1]=strcpy(s[0]);
}
MString::~MString()
int MString::size(int len){
for(int i=0; i<*s;i++);
cout<<s[i]<<" ";
}
void MString::find(char){
if(s.find(s[1])!=-1)
count <<"find"<<s[0]<<endl;
}
void MString::swap(MString &t){
s[0].swap(s[1]);
}
int main{
MString t("I am a student","teacher")
MString p=s;
}

}

  • 写回答

2条回答 默认 最新

  • threenewbee 2016-11-03 12:51
    关注

    s[1]=strcpy(s[0]);
    ->
    strcpy(s[0], t.s[0]);
    return &this;

    MString t("I am a student","teacher")
    ->
    MString t("I am a student","teacher");

    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计