Question: What's the missing code? and where to put it? Requirements: Implement the following string methods O . DynamicString() //Constructs an empty string. Allocating enough memory



What's the missing code? and where to put it?
Requirements: Implement the following string methods O . DynamicString() //Constructs an empty string. Allocating enough memory to store the null character DynamicString(const char* str) //Constructs a string by copying the characters from the char array str to this object. You should dynamically allocate enough memory for the entire string. int len() const //returns the length of this string (i.e. the number of characters in the array not including the null char) const char* c_str() const // returns a pointer to the underlying char array char char_at(int position) const // returns the char at the specified position char& operator[](int position) // returns the char at the specified position bool startsWith(const DynamicString& other) const //True if other is a prefix of this string bool endsWith(const DynamicString& other) const //True if other is a suffix of this string int compare(const Dynamic String& other) const // negative if this is smaller than other, o if this is equal to other, positive if this is larger than other int iCompare(const DynamicString& other) const // same as compare but is case-insensetive Dynamic String& tolower() // converts the string to lowercase Dynamic String& toUpper() // converts the string to uppercase Dynamic String& replace(char old, char new) //replace all instances of old with new int find(char needle, int start=0) const //return the first index of the specified char or -1 if the char is not found starting from index start. int reverseFind(char needle, int start) const //return the right-most index (less than or equal to start) of the specified char or -1 if the char is not found. . O . DynamicString.cpp* + x ynamicString Test.cpp Challenge 1 (C #include "Dynamicstring.h" #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
