C++에서 제공되는 string class의 일부 기능을 수행하는 MyString class를 만드시오.
제출할 시에는 MyString.cpp와 MyString.h만 제출하시오.
채점에서는 별도로 제작한 main() 함수를 사용하여 테스트 할 예정이므로
본인이 만든 드라이버 프로그램인 main.cpp는 충분한 테스트를 하는데 사용하되 제출본에서는 제외하시오.
유의사항
strcpy, strcat 을 포함한 모든 string.h 또는 cstring 에서 제공하는 문자열 라이브러리 함수 사용 금지 (get()은 사용 가능. getchar() 대신 get을 사용할 것 )
operator >> 와 operator <<, stoi() 를 제외한 모든 함수는 멤버함수로 구현할 것
아래 상세하게 명시하지 않은 모든 기능은 일반 string 클래스와 동일하게 작동하도록 구현할 것
MyString::MyString()
MyString::MyString(const MyString &srcStr)
MyString::~MyString()
MyString::operator = (const MyString &srcStr)
int MyString::length()
char MyString::at(int pos)
bool MyString::empty()
istream& operator >>(istream& is, MyString &str)
ostream& operator <<(ostream& os, const MyString &str)
모든 기능은 기존 string과 동일하게 동작해야 함
MyString& MyString::operator = (const char *srcStr)
const MyString MyString::operator + (const char *str2nd)
const MyString MyString::operator + (const MyString& str2nd)
const MyString MyString::append(const char *str2nd)
const MyString MyString::append(const MyStsring& str2nd)
bool MyString::operator ==(const MyString &str)
bool MyString::operator !=(const MyString &str)
int MyString::find(const char *subStr)
int MyString::find(const MyString subStr)
int MyString::find(int pos, const char *subStr)
int MyString::find(int pos, const MyString subStr)
(const 등의 명시나 return type은 적절하게 알아서 구현. 적절성은 평가 점수에 고려됨)
(문자열 크기를 resize해야 하는 경우를 꼼꼼하게 잘 살펴서 구현할 것.
resize는 word단위(8byte)로 구현되도록 할 것)
MyString(const char *str2nd)
operator += (char *str2nd)
operator <(MyString)
operator <=(MyString)
operator >(MyString)
operator >=(MyString)
operator <(char *str2nd)
operator <=(char *str2nd)
operator >(char *str2nd)
operator >=(char *str2nd)
substr(int pos, int cnt)
insert(int pos, char *subStr)
insert(int pos, MyString subStr)
replace(int pos, int cnt, char *subStr)
replace(int, int, MyString)
erase(int pos, int cnt)
int stoi(const MyString &str, int pos = 0 , int base = 10)
operator [](int pos)