Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me implement these programs in c++. we are using char arrays and not string this is a beginners lever course so please exlain

please help me implement these programs in c++. we are using char arrays and not string this is a beginners lever course so please exlain with inline comments where you can!
image text in transcribed
image text in transcribed
above I have my .h and .cpp file
i need help implementing:
the value subscript operator; which should return the specified char from the string
const char & operator [](int) const;
the reference subscript operator; which should return the specified char from the string
char & operator [](int);
26 27 string & string::operator [] = (int) const 28 { 29 if(this != &right) 30 } 31 32 string & string :: operator [] = (int word) 33 34 35 ) 36 stringi size 0 #pragma onge winclude #include //uning namespace std; const int MAX - 1001 3 struot string ant data; //data type of value string(); 1/constructor -string(); // destructor string(const string&); //copy construct, initializes strings data string(const string"); //Initializes the stringo data to the parameter string & operator - (const string&); Nc-string constructor, indtilizou strings data const string & operator (int) const; //reset the strings data to the empty string string & operator (int); //olue substript operator, returns species char to string int size il size accessori returns the size of the string 20 Ant length(); // length accensoro returns the length of the string R1); 23 bool operator - (const string & left, const string & right); //Relational comparison 24 bool operator > (const string & left, conot string & right); //Relational comparison 26 std::ostream& operator > (std:tistream&, const string &); // stream extraction 9 22 26 27 string & string::operator [] = (int) const 28 { 29 if(this != &right) 30 } 31 32 string & string :: operator [] = (int word) 33 34 35 ) 36 stringi size 0 #pragma onge winclude #include //uning namespace std; const int MAX - 1001 3 struot string ant data; //data type of value string(); 1/constructor -string(); // destructor string(const string&); //copy construct, initializes strings data string(const string"); //Initializes the stringo data to the parameter string & operator - (const string&); Nc-string constructor, indtilizou strings data const string & operator (int) const; //reset the strings data to the empty string string & operator (int); //olue substript operator, returns species char to string int size il size accessori returns the size of the string 20 Ant length(); // length accensoro returns the length of the string R1); 23 bool operator - (const string & left, const string & right); //Relational comparison 24 bool operator > (const string & left, conot string & right); //Relational comparison 26 std::ostream& operator > (std:tistream&, const string &); // stream extraction 9 22

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

7. General Mills

Answered: 1 week ago

Question

3. Describe the strategic training and development process.

Answered: 1 week ago