Question: this is the client program ( don ' t change or you get a 0 in this project ) / * * - - -
this is the client programdont change or you get a in this project 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 ConcatTest functions checks the overloaded and operators that do string concatenation. 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 compilelink complaints. #include "mystring.h #include #include for toupper #include #include #include using namespace std; using namespace csmystring; void BasicTest; void RelationTest; void ConcatTest; void CopyTest; MyString AppendTestconst MyString& ref, MyString val; string boolStringbool convertMe; int main BasicTest; RelationTest; ConcatTest; CopyTest; string boolStringbool convertMe if convertMe return "true"; else return "false"; void BasicTest MyString s; int stringLength; cout Testing basic String creation & printing" endl; const MyString strsMyStringWow MyStringC is neat!" MyString MyStringaz; for int i ; i ; i cout "string i strsi endl; cout endl Now reading MyStrings from file" endl; cout endl first, word by word" endl; ifstream inmystringtxt; assertin; while inpeek# inignore
; in s; while in cout "Read string s endl; in s; inclose; cout endl now, line by line" endl; ifstream inmystringtxt; assertin; while inpeek# inignore
; sreadin
; while in cout "Read string s endl; sreadin
; inclose; cout endl Testing access to characters using const endl; const MyString sabcdefghijklmnopqsrtuvwxyz; cout "Whole string is s endl; cout "now char by char: ; stringLength slength; for int i ; i stringLength; i cout si; cout endl Testing access to characters using nonconst endl; MyString sabcdefghijklmnopqsrtuvwxyz; cout "Start with s; stringLength slength; for int i ; i stringLength; i si touppersi; cout and convert to s endl; void RelationTest cout
Testing relational operators between MyStrings
; const MyString strsMyStringapp MyStringapple MyString MyStringBanana MyStringBanana; for int i ; i ; i cout "Comparing strsi to strsi endl; cout tIs left right? boolStringstrsi strsi endl; cout tIs left right? boolStringstrsi strsi endl; cout tIs left right? boolStringstrsi strsi endl; cout tIs left right? boolStringstrsi strsi endl; cout tDoes left right? boolStringstrsi strsi endl; cout tDoes left right boolStringstrsi strsi endl; cout
Testing relations between MyStrings and char
; MyString she; const char t "hello"; cout "Comparing s to t endl; cout tIs left right? boolStrings t endl; cout tIs left right? boolStrings t endl; cout tIs left right? boolStrings t endl; cout tIs left right? boolStrings t endl; cout tDoes left right? boolStrings t endl; cout
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
