出国留学--美国商学院申请流程 联系客服

发布时间 : 星期六 文章出国留学--美国商学院申请流程更新完毕开始阅读27fb277401f69e3142329407

MyString::MyString(const char* p)

{

if (p == NULL)

cpBody[0] = '\\0';

else

strncpy(cpBody, p, 80);

}

MyString::MyString(int i)

{ int j;

for (j = 0; j < i && j < 80; j++)

cpBody[j] = ' ';

cpBody[j] = '\\0';

}

MyString::MyString(MyString& s)

{ *this=s;

/* 或者改用如下语句:int length;

length=strlen(s.cpBody);

for(int i=0;

i

}

MyString& MyString::operator[](int i)

{ static MyString s;

int j;

s = *this;

for (j = i; cpBody[j] != '\\0'; j++)

s.cpBody[j-i] = s.cpBody[j];

s.cpBody[j-i] = '\\0';

return s;

}

MyString& operator+(int N, MyString& s)

{ static MyString st;

int i,length;

length=strlen(s.cpBody);

for(i=0;i

s.cpBody[length+i]=s.cpBody[length-1];

s.cpBody[length+i]='\\0';

st=s;