Question: Make the flie mystring.h , mystring.cpp and the main.cpp . This is the client program : / * * These functions are designed to help
Make the flie mystring.h mystring.cpp and the main.cpp This is the 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 compilelink complaints. #include "mystring.h #include for toupper #include #include using namespace std; using namespace csmystring; void BasicTest; void RelationTest; void CopyTest; MyString AppendTestconst MyString& ref, MyString val; string boolStringbool convertMe; int main BasicTest; RelationTest; CopyTest; void BasicTest MyString s; cout Testing basic String creation & printing" endl; const MyString strs MyStringWow MyStringC is neat!" MyString MyStringaz; for int i ; i ; i cout "string i strsi endl; cout endl Testing access to characters using const endl; const MyString sabcdefghijklmnopqsrtuvwxyz; cout "Whole string is s endl; cout "now char by char: ; for int i ; i slength; i cout si; cout endl Testing access to characters using nonconst endl; MyString sabcdefghijklmnopqsrtuvwxyz; cout "Start with s; for int i ; i slength; i si touppersi; cout and convert to s endl; string boolStringbool convertMe if convertMe return "true"; else return "false"; void RelationTest cout
Testing relational operators between MyStrings
; const MyString strs MyStringapp MyStringapple MyString MyStringBanana MyStringBanana; for int i ; i ; i cout "Comparing strsi to strsi endl; cout Is left right? boolStringstrsi strsi endl; cout Is left right? boolStringstrsi strsi endl; cout Is left right? boolStringstrsi strsi endl; cout Is left right? boolStringstrsi strsi endl; cout Does left right? boolStringstrsi strsi endl; cout Does 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 Is left right? boolStrings t endl; cout Is left right? boolStrings t endl; cout Is left right? boolStrings t endl; cout Is left right? boolStrings t endl; cout Does left right? boolStrings t endl; cout Does left right boolStrings t endl; MyString uwackity; const char v "why"; cout "Comparing v to u endl; cout Is left right? boolStringv u endl; cout Is left right? boolStringv u endl; cout Is left right? boolStringv u endl; cout Is left right? boolStringv u endl; cout Does left right? boolStringv u endl; cout Does left right boolStringv u endl; MyString AppendTestconst MyString& ref, MyString val valB; return val; void CopyTest cout
Testing copy constructor and operator on MyStrings
; MyString origcake; MyString copyorig; invoke copy constructor copyf; change first letter of the copy cout "original is orig copy is copy endl; MyString copy; makes an empty string copy orig; invoke operator copy orig; invoke operator copyf; change first letter of the copy cout "original is orig copy is copy endl; copy "Copy Cat"; copy copy; copy onto self and see what happens cout "after self assignment, copy is copy endl; cout "Testing pass & return MyStrings by value and ref" endl; MyString val "winky"; MyString sum AppendTestBoo val; cout "after calling Append, sum is sum endl; cout "val is val endl; val sum; cout "after assing, val is val endl;
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
