Assignment #6 - Array Practice Due: Wed, Nov 16 Objective To gain practice with arrays and common array algorithms, as well as the use of array parameters in functions. Task This assignment will...


Assignment #6 - Array Practice<br>Due: Wed, Nov 16<br>Objective<br>To gain practice with arrays and common array algorithms, as well as the use of array<br>parameters in functions.<br>Task<br>This assignment will consist of writing several functions that manipulate arrays or access data<br>from arrays, as well as a test program that will allow interactive testing of the array functions.<br>Part 1: Functions<br>Write the following functions. Each one takes in an integer array as a parameter, and other<br>necessary parameters are returns are described. Make sure the parameters are in the order<br>specified. Make sure to use the const qualifier on the array parameter on any function where it is<br>appropriate. A sample CALL is given for each function.<br>• Insert<br>Write a function called Insert that takes in four parameters:<br>o an integer array<br>o the size of the array<br>o the new value to be inserted into the array<br>o the index at which to insert the new value<br>This function should insert a a new value into the array, at the specified index. Note that<br>this means that other values have to

Extracted text: Assignment #6 - Array Practice Due: Wed, Nov 16 Objective To gain practice with arrays and common array algorithms, as well as the use of array parameters in functions. Task This assignment will consist of writing several functions that manipulate arrays or access data from arrays, as well as a test program that will allow interactive testing of the array functions. Part 1: Functions Write the following functions. Each one takes in an integer array as a parameter, and other necessary parameters are returns are described. Make sure the parameters are in the order specified. Make sure to use the const qualifier on the array parameter on any function where it is appropriate. A sample CALL is given for each function. • Insert Write a function called Insert that takes in four parameters: o an integer array o the size of the array o the new value to be inserted into the array o the index at which to insert the new value This function should insert a a new value into the array, at the specified index. Note that this means that other values have to "move" to make room. The last value in the array will just disappear from the array. If the index is out of bounds for the array, abort the function with no change made to the array. This function does not return a value. Sample call: // Suppose the array "list" is {2, 4, 6, 8, 10, 12} Insert(list, 6, 100, 3); // insert the value 100 at index 3. // "list" is now {2, 4, 6, 100, 8, 10} • Delete Write a function called Delete that takes in three parameters: o an integer array o the size of the array o the index of the item to delete This function should delete the value at the given index. The remaining items in the array will need to shift over to fill the "empty" slot. The last item in the array (now vacant) should be set to 0. If the given index is out of bounds for the array, abort the function without deleting anything. This function does not return a value. Sample call: // Suppose the array "list" is {2, 4, 6, 8, 10, 12} Delete (list, 6, 2); // delete the value at index 2. // "list" is now {2, 4, 8, 10, 12, 0}
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here