#include // now can use strlen #include "bstring.h" /* char* str; // the pointer to our dynamic array of chars int size; // the size of the string (e.g. "Hello" would be 5) // allocation will be size+1 to store as a c-string */ // definitions of friend functions bool operator< (const BString& x, const BString& y) { } bool operator> (const BString& x, const BString& y) { } bool operator<=(const BString& x, const BString& y) { } bool operator>=(const BString& x, const BString& y) { } bool operator==(const BString& x, const BString& y) { } bool operator!=(const BString& x, const BString& y) { } BString operator+(const BString& x, const BString& y) { } ostream& operator<< (ostream& os, const BString& s) { os << s.str; // print the c-string s.str return os; } istream& operator>> (istream& is, BString& s) { } // member function definitions BString::BString() // should build empty string { size = 0; str = new char[1]; str[0] = '\0'; // set to null character, empty c-string } BString::BString(const char* c) // build a string object that has same data as c (the incoming c-string) { size = strlen(c); str = new char[size+1]; strcpy(str, c); // can do this as long as internal storage // has room for null char '\0' } BString::BString(int x) { } BString::~BString() { } BString::BString(const BString& s) { } BString& BString::operator=(const BString& s) { } int BString::GetSize() const { } BString BString::Substring(int index, int len) { } void BString::Resize(int newsize) { }