C++ Define a class called MyString. MyString should contain a Menu as follow: My first MyString Menu Option Cost ======================================= 1. Create a substring $5 2. Find a reference $10 3. Remove part of the string $7 4. Add two strings to each other $4 5. Check if a string is empty $1 6. Check if two strings are equal $6 7. Insert a string inside another string $3 8. Exit The user will enter two strings str1 and str2 and should be able to keep selecting options until option 8 is selected (exit). After each selection the cost amount will change. At the end of each selection you should print out the result and at the end printout the following: Your total cost is: $15 (or whatever is the sum)
C++
Define a class called MyString.
MyString should contain a Menu as follow:
My first MyString Menu
Option Cost
=======================================
1. Create a substring $5
2. Find a reference $10
3. Remove part of the string $7
4. Add two strings to each other $4
5. Check if a string is empty $1
6. Check if two strings are equal $6
7. Insert a string inside another string $3
8. Exit
The user will enter two strings str1 and str2 and should be able to keep selecting options until option 8 is selected (exit). After each selection the cost amount will change. At the end of each selection you should print out the result and at the end printout the following:
Your total cost is: $15 (or whatever is the sum)
(Hint: for the functions use table 1 and table 2)
Table 1

![EXAMPLE
Constructors
string str;
string str("string");
string str(aString);
Element access
str[i]
str.at (i)
str.substr(position, length)
Assignment/Modifiers
: str2;
str1 =
strl + str2;
str.empty()
REMARKS
Default constructor; creates empty string object str.
Creates a string object with data "string".
Creates a string object str that is a copy of aString.
aString is an object of the class string.
Returns read/write reference to character in str at index i.
Returns read/write reference to character in str at index i.
Returns the substring of the calling object starting at posi-
tion and having length characters.
Allocates space and initializes it to str2's data, releases
memory allocated for str1, and sets strl's size to that of
str2.
Character data of str2 is concatenated to the end of str1;
the size is set appropriately.
Returns true if str is an empty string; returns false
otherwise.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9b507547-b332-47b2-8e5e-934d44333819%2Fc1b2ddc7-52bb-48ab-8d26-6d1824edc182%2Fv4ymsf5_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images









