Question: 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!
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