Any help for this C++ question would be absolutely positively awesome! A string
ID: 3622427 • Letter: A
Question
Any help for this C++ question would be absolutely positively awesome!A string is a lot like a vector (or resizable array) of characters. Imagine that strings do not exist in C++, and you have to create them. You would need to:
A. Define a suitable class or struct for representing a string of characters, realising that strings can have any length whatsoever, from zero up.
B. Define a constructor that sets up an initially empty string.
C. Create a method that allows a single character to be added to the end of one of your strings.
D. Create a method that allows one string to be added to the end of another.
E. Create a function that will compare two strings to tell you whether they are the same, ignoring the difference between capital and little letters (so that “CAT” is considered to be the same as “cat”).
Do those things.
______________________________________________________________________________
As an aid to understanding, here is a possible use of your creations:
MyString one, two, three;
one.add('c');
one.add('a');
two.add('C');
two.add('A');
two.add('T');
one.add('t');
three.add(two);
three.add('-');
three.add(one);
three.add(two);
if (same(one, two))
cout << "Yes.";
if (!same(two, three))
cout << "No.";
That should cause “Yes.No.” to be printed, and at the end one would hold “cat”, two would hold “CAT”, and three would hold “CAT-catCAT”.