Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started