Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 9, Problem 6PP

Chapter 9, Problem 6PP, One problem with dynamic arrays is that once the array is created using the new operator, the size

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 as you can with a vector. This project asks you to create functions that use dynamic arrays to emulate the behavior of a vector.

First, write a program that creates a dynamic array of five strings. Store five names of your choice into the dynamic array. Next, complete the following two functions:

string* addEntry(string *dynamicArray, int &size, string

newEntry);

This function should create a new dynamic array one element larger than dynamicArray, copy all elements from dynamicArray into the new array, add the new entry onto the end of the new array, increment size, delete dynamicArray, and return the new dynamic array.

string* deleteEntry(string *dynamicArray, int &size, string

entryToDelete);

This function should search dynamicArray for entryToDelete. If not found, the request should be ignored and the unmodified dynamicArray returned. If found, create a new dynamic array one element smaller than dynamicArray. Copy all elements except entryToDelete into the new array, delete dynamicArray, decrement size, and return the new dynamic array. Test your functions by adding and deleting several names to the array while outputting the contents of the array. You will have to assign the array returned by addEntry or deleteEntry back to the dynamic array variable in your main function.

Blurred answer
Students have asked these similar questions
Create a dynamic array that contains an int array. dynamic array, array inside when the existing array is full and a new element needs to be added will double its size, make all the elements of the old array the same will copy the indexes and add the element to the new array. Use the following functions. Write in C language. 1.append(dynamic array, new element): function sent to itself Adds the element sturct to the end of the array inside DynamicArray. Place If not, it behaves in accordance with the dynamic array definition given above. 2. get(index): The element in the index sent to it by the function takes it from the array it hosts and sends it back. ATTENTION ! : Please use a dynamic array and this array with struct structure. I don't want a link list. Do not post wrong or copied codes. Be sure to use the append and get functions given above Please do not solve the question I asked with the same code and copy and paste the code, my right to the question is running out. Solve the…
Create a dynamic array that contains an int array. dynamic array, array inside when the existing array is full and a new element needs to be added will double its size, make all the elements of the old array the same will copy the indexes and add the element to the new array. Use the following functions. Write in C language. 1.append(dynamic array, new element): function sent to itself Adds the element sturct to the end of the array inside DynamicArray. Place If not, it behaves in accordance with the dynamic array definition given above. 2. get(index): The element in the index sent to it by the function takes it from the array it hosts and sends it back. Do not use link lists. Solve the question using array. Use it as a struct DynamicArray.
Create a dynamic array that contains an int array. dynamic array, array inside when the existing array is full and a new element needs to be added will double its size, make all the elements of the old array the same will copy the indexes and add the element to the new array. Use the following functions. Write in C language. 1.append(dynamic array, new element): function sent to itself Adds the element sturct to the end of the array inside DynamicArray. Place If not, it behaves in accordance with the dynamic array definition given above. 2. get(index): The element in the index sent to it by the function takes it from the array it hosts and sends it back.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License