Question: 1 You wrote a program that used a function called deleteRepeats that had an array of characters and your function deleted all repeats and then

 1 You wrote a program that used a function called deleteRepeats
that had an array of characters and your function deleted all repeats

1 You wrote a program that used a function called deleteRepeats that had an array of characters and your function deleted all repeats and then created a new dynamic array using a standard unique pointer. Write this function, but make it remove all the corresponding repeated letters from the array. The array is passed but not the SIZE b/c it is a global constant. The function returns a unique pointer. For our purposes, we informally define 'corresponding elements as where the first element in an array and the last element of the array are corresponding elements. Similarly, the second element and the element just before the last element are corresponding elements. The third element and the element just before the element just before the last element are corresponding elements -- and so on. Your function should determine if a letter repeated in the corresponding position of the array and, if so, that letter is deleted. Then go to the next, etc. The non-repeats or remaining letters will form the new dynamic array and the size must be exactly that of the remaining unique letters. 10 points technical 15 points correctness Here is the driver and your function header. Yes, you may add parameters to the function if you need to: #include #include deleteRepeats (charlik int main() -6 29 i/test array of chars char originalArray[SIZEJ: originalArray (0) = 'a'; originalArray [1] = 'b'; originalArray [2] = 'b! originalArray (3) originalArray (4) -a's originalArray (5) originalArray [6] 'a': originalArray [7] = 'c': originalArray [8] = 'b': originalArray [9] = 'a': deleteRepeats function call, and stores returned pointer in noRepeats std unique ptrcchard> neverRepeat-deleteRepeats[originalArray): 32 35 return 0; 38 = w Takes a chararray and removes corresponding letters HLED diray Di Cildi char originalArray[SIZE]: originalArray (0] = 'a'; originalArray (1) = 'b'; originalArray [2] = 'b'; originalArray (3] = ''; originalArray [4] = 'a'; originalArray [5] = 'c': originalArray [6] = 'a'; originalArray [7] = 'c'; originalArray [8] = 'b'; originalArray [9] = 'a'; I/deleteRepeats function call, and stores returned pointer in noRepeats std:unique_ptr never Repeat = deleteRepeats[originalArray); return 0; W Takes a char array and removes corresponding letters // precondtion: a valid c-string // postcondition: returns smartpointer pointing to the new and now dynamic char array std::unique ptr-char[]> deleteRepeats (char originalArray[]) 1 //YOUR CODE GOES HERE go Paragraph 2 BIU

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!