Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

B. Write a function named remove which has one input parameter named value (a in

ID: 3880380 • Letter: B

Question

B. Write a function named remove which has one input parameter named value (a integer to be removed from the array) and two output parameters: numbers (an array of integers arranged in ascending order) and size (an integer representing the number of elements used in the array). When the function is called, value is removed from the array in the proper location so that the elements in the array are still in ascending order. For example, if the array contains {-4, 3, 8, 10, 15, 23, 29}, the content of the array changes to {-4, 3, 8, 15, 23, 29} when the function remove is called and the value 10 is passed to the function. The array size will change from 7 to 6. On the other hand if value containing 30 is passed when the function is called, the array numbers does not contain 30. Therefore, the array numbers stays intact. The fact that size is positive is the precondition. The postcondition of the function has two possible outcomes (1) value is removed from numbers at the right position, or (2) the array stays intact if value does not exist in the array. Below is the function prototype of this function. void remove(int value, int numbers[], int &size); Implement each function definition in a separate file with its test driver in the same directory (assign2). Name the files assign2a.cpp and assign2b.cpp, respectively. Add the following function prototype its definition to each program to display the array before and after calling the function.

void displayIntArray(int [], int);

void displayIntArray(int values[],

int size)

{

int index;

{

cout << setw(WIDTH) // WIDTH = 6

<< values[index];

if ((index + 1) % MAX_SIZE == 0) // MAX_SIZE = 8

cout << endl;

}

cout << endl;

} // end of displayIntArray

Explanation / Answer

void remove(int value , int numbers[] , int &size)

{

int count=0;

}