Question: See also client program and correct output. MyString object will have the ability to make a full deep - copy of itself when copied of

See also client program and correct output.
MyString object will have the ability to make a full deep-copy of itself when copied of the assignment, but full documentation will be required for the next part. Here is a list of the operations this class must support:
A length member function that returns the number of characters in the string. Use strlen().basis. Use strcpy(). Printing a MyString to a stream using an overloaded (insertion) operator, which should simply print out its characters. Use of the comparison operator. You must do this using only one function for each of the six operators. Don't forget to include the big-3. may NOT use anything from the C++ string class!!
file: #pragma warning(disable:4996)"cs_mystring". Client program /** These functions are designed to help you test your MyString objects, * as well as show the client usage of the class. ** The BasicTest function builds an array of strings using various * constructor options and prints them out. It also uses the String * stream operations to read some strings from a data file. ** The RelationTest function checks out the basic relational operations *(==,!=,, etc) on Strings and char *s.*** The CopyTest tries out the copy constructor and assignment operators * to make sure they do a true deep copy. ** Although not exhaustive, these tests will help you to exercise the basic * functionality of the class and show you how a client might use it.** While you are developing your MyString class, you might find it * easier to comment out functions you are ready for, so that you don't * get lots of compile/link complaints. */ #include "mystring.h" #include // for toupper() #include #include using namespace std; using namespace cs_mystring; void BasicTest(); void RelationTest(); void CopyTest(); MyString AppendTest(const MyString& ref, MyString val); string boolString(bool convertMe); int main(){ BasicTest(); RelationTest(); CopyTest(); } void BasicTest(){ MyString s; cout "----- Testing basic String creation & printing" endl; const MyString strs[]={MyString("Wow"), MyString("C++ is neat!"), MyString(""), MyString("a-z")}; for (int i =0; i 4; i++){ cout "string [" i "]=" strs[i] endl; } cout endl "----- Testing access to characters (using const)" endl; const MyString s1("abcdefghijklmnopqsrtuvwxyz"); cout "Whole string is " s1 endl; cout "now char by char: "; for (int i =0; i s1.length(); i++){ cout s1[i]; } cout endl "----- Testing access to characters (using non-const)" endl; MyString s2("abcdefghijklmnopqsrtuvwxyz"); cout "Start with " s2; for (int i =0; i s2.length(); i++){ s2[i]= toupper(s2[i]); } cout " and convert to " s2 endl; } string boolString(bool convertMe){ if (convertMe){ return "true"; } else { return "false"; }} void RelationTest(){ cout "
----- Testing relational operators between MyStrings
"; const MyString strs[]={MyString("app"), MyString("apple"), MyString(""), MyString("Banana"), MyString("Banana")}; for (int i =0; i 4; i++){ cout "Comparing " strs[i]" to " strs[i+1] endl; cout " Is left right? " boolString(strs[i] strs[i+1]) endl; cout " Is left = right? " boolString(strs[i]= strs[i+1]) endl; cout " Is left > right? " boolString(strs[i]> strs[i+1]) endl; cout " Is left >= right? " boolString(strs[i]>= strs[i+1]) endl; cout " Does left == right? " boolString(strs[i]== strs[i+1]) endl; cout " Does left != right ?" boolString(strs[i]!= strs[i+1]) endl; } cout "
----- Testing relations between MyStrings and char *
"; MyString s("he"); const char *t = "hello"; cout "Comparing " s " to " t endl; cout " Is left right? " boolString(s t) endl; cout " Is left = right? " boolString(s = t) endl; cout " Is left > right? " boolString(s > t) endl; cout " Is left >= right? " boolString(s >= t) endl; cout " Does left == right? " boolString(s == t) endl; cout " Does left != right ?" boolString(s != t) endl; MyString u("wackity"); const char *v = "why"; cout "Comparing " v " to " u endl; cout " Is left right? " boolString(v u)
See also client program and correct output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!