Question: C++ DATA STRUCTURES 1. A string is a lot like a vector (or resizable array) of characters Imagine that strings do not exist in C++,

C++ DATA STRUCTURES

C++ DATA STRUCTURES 1. A string is a lot like a vector

1. 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: Define a suitable class or struct for representing a string of characters, realising that strings can have any length whatsoever, from zero up 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 Create a method that allows one string to be added to the end of another 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

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 Databases Questions!