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

Writea function called delete-repeats that has a partially filled arrayof charac

ID: 3616661 • Letter: W

Question

Writea function called delete-repeats that has a partially filled arrayof characters as a formal parameter and that deletes all repeatedletters from the array. Since a partially filled array requires twoarguments, the function will actually have two formal parameters:an array parameter and a formal parameter of type int that givesthe number of array positions used. When a letter is deleted, theremaining letters are moved forward to fill in the gap. This willcreate empty positions at the end of the array so that less of thearray is used. Since the formal parameter is a partially filledarray, a second formal parameter of type int will tell how manyarray positions are filled. This second formal parameter will be acal-by-reference parameter and will be changed to show how much ofthe array is used after the repeated letters are deleted.

Forexample, consider the following code:

Chara [10];

a [0]= ‘a’;

a [1]= ‘b’;

a [2]= ‘a’;

a [3]= ‘c’;

intsize = 4;

delete_repeats (a, size);

afterthis code is executed, the value of a[0] is ‘a’, thevalue of a[1] is ‘b’, the value of a[2] is‘c’, and the value of size is 3. (The value of a[3] isno longer of any concern, since the partially filled array nolonger uses this indexed variable.)

Youmay assume that the partially filled array contains only lowercaseletters. Embed your function in a suitable test program.

Explanation / Answer

please rate - thanks #include #include using namespace std; void delete_repeats(char[],int&); int main() {char a[8]={'a','b','a','c','a','c','d','a'}; int count=8,i; cout