subject
Computers and Technology, 03.04.2020 15:23 56340

Question: One Problem With Dynamic Arrays Is That Once The Array Is Created Using The New Operator The Size Cannot Be Changed. For Example, You Might Want To Add Or Delete Entries From The Array Similar To The Behavior Of A Vector. This Project Asks You To Create A Class Called DynamicStringArray That Includes Member Functions That Allow It To Emulate The Behavior ...
This problem has been solved!
See the answer
One problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector. This project asks you to create a class called dynamicStringArray that includes member functions that allow it to emulate the behavior of a of strings.
The class should have the following:
1. A private member variable called dynamicArray that references a dynamic array of type string.
2. A private member variable called size that holds the number of entries in the array.
3. A default constructor that sets the dynamic array to Null and sets size to 0.
4. A function that returns size.
5. A function named addEnrty that takes a string as input. The function should create a new dynamic array one element larger than dynamicArray, copy all elements from dynamicArray into the new array, add the new string onto the end of the new array, increment size, delete the old dynamicArray, and then set dynamicArray to the new array.
6. A function named deleteEnrty that takes a string as input. The function should search dynamicArray for the string. If not found, it returns false. If found, it creates a new dynamic array one element smaller than dynamicArray. It should copy all elements except the input string into the new array, delete dynamicArray, decrement size, and return true.
7. A function named getEntry that takes an integer as input and returns the string at that index in dynamicArray. It should return Null if the index is out of dynamicArray

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
question
Computers and Technology, 24.06.2019 09:00
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
question
Computers and Technology, 24.06.2019 13:00
Why should you evaluate trends when thinking about a career path?
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
What is the next step if your volume does not work on computer
Answers: 2
You know the right answer?
Question: One Problem With Dynamic Arrays Is That Once The Array Is Created Using The New Operator T...
Questions
question
Computers and Technology, 27.10.2020 04:50
question
Mathematics, 27.10.2020 05:00
question
Mathematics, 27.10.2020 05:00
question
Mathematics, 27.10.2020 05:00
question
Mathematics, 27.10.2020 05:00
question
Mathematics, 27.10.2020 05:00
Questions on the website: 13722367