Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help fill in the code to implement an array class for characters. /* Comments help to know what to do in each function. Needs

Please help fill in the code to implement an array class for characters. /* Comments help to know what to do in each function. Needs to be in C++

/**

* Set a new size for the array. If \a new_size is less than the current

* size, then the array is truncated. If \a new_size if greater then the

* current size, then the array is made larger and the new elements are

* not initialized to anything. If \a new_size is the same as the current

* size, then nothing happens.

* The array's original contents are preserved regardless of whether the

* array's size is either increased or decreased.

* @param[in] new_size New size of the array

*/

void resize (size_t new_size);

/// Shrink the array to reclaim unused space.

void shrink ();

/**

* Locate the specified character in the array. The index of the first

* occurrence of the character is returned. If the character is not

* found in the array, then -1 is returned.

* @param[in] ch Character to search for

* @return Index value of the character

* @retval -1 Character not found

*/

int find (char ch) const;

/**

* @overload

* This version allows you to specify the start index of the search. If

* the start index is not within the range of the array, then the

* std::out_of_range exception is thrown.

* @param[in] ch Character to search for

* @param[in] start Index to begin search

* @return Index value of first occurrence

* @retval -1 Character not found

* @exception std::out_of_range Invalid index

*/

int find (char ch, size_t start) const;

/**

* Test the array for equality.

* @param[in] rhs Right hand side of equal to sign

* @retval true Left side is equal to right side

* @retval false Left side is not equal to right side

*/

bool operator == (const Array & rhs) const;

/**

* Test the array for inequality.

* @param[in] rhs Right-hand size of not equal to sign

* @retval true Left side is not equal to right side

* @retval false Left size is equal to right side

*/

bool operator != (const Array & rhs) const;

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

What are the required lease disclosures for the lessor and lessee?

Answered: 1 week ago

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago