Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming. The project is described in the textbook, Chapter 9 PROGRAMMING PROJECTS #6. It is found on page 521 in the 8th edition of

C++ Programming. The project is described in the textbook, Chapter 9 PROGRAMMING PROJECTS #6. It is found on page 521 in the 8th edition of the textbook and on page 536 of the 9th edition.

Vectors are similar to arrays except the length of an array is fixed when it is created. The length of a vector can automatically grow or shrink as the program executes. This lab is asking you to create a dynamic array of five strings. Functions are available to either add an entry or delete an entry from the array. The size of the array should grow or shrink when one of these functions is called.

When adding a new string to the array, this is to be accomplished by creating a new dynamic array, adding the new string into the new array, deleting the old array and returning the new dynamic array.

When deleting a string from the array, a new dynamic array is to be created by copying all of the data from the old array (except the string to be deleted) into a new array, deleting the old array and returning the new dynamic array. Nothing is to be done if the string can not be found in the old array.

The functions are to be delcared as follows:

string* addEntry(string *dynamicArray, int &size, string newEntry);

string* deleteEntry(string *dynamicArray, int &size, string entryToDelete);

This function should search dynamicArray for entryToDelete. If nor found, the request should be ignored and the unmodified dynamicArray returned. If found, create a new dynamic array one ele dynamicArray. Copy all elements except entryToDe array, delete dynamicArray, decrement size, and retur v one element smalle vToDelete into the and return the new du The te w dynamik array. 10 the amay vill have to assign ack to the dynamica Test your functions by adding and deleting several while outputting the contents of the array. You will be array returned by addEntry or deleteEntry back to th variable in your main function. mic away

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

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

Intermediate Accounting

Authors: James D. Stice, Earl K. Stice, Fred Skousen

17th Edition

978-0324592375

Students also viewed these Programming questions