Question: Having trouble with this problem. Please use template. Thank you!! /Problem: to write (and test) a function that has a //partially filled array of characters

Having trouble with this problem. Please use template. Thank you!!

/Problem: to write (and test) a function that has a //partially filled array of characters as a formal parameter. //A partially filled array requires two parameters, the array //itself and a size parameter. The function deletes all //repeated letters from the array, and close up the 'empty' //positions, then decrease the size parameter. //Test this function.

//The main program generates test data.

#include

//modifies array to delete all instances of any duplicates //of characters found in array void deleteRepeats( char array[], int& size );

//returns number of characters up to the null terminator, \0 int length( char array[]);

int main() { using namespace std; char array[81] = "mary had a little lamb. its fleece was white as snow."; cout << array << endl; int size; size = length(array); cout << "size = " << size << endl;

deleteRepeats( array, size);

cout << "reduced array = " << array << endl; cout << "reduced array size = " << size << endl;

char array1[81] ="Now is the time for all good men to come to the aid of the country.";

cout << array1 << endl; size = length(array1); cout << "size = " << size << endl;

deleteRepeats( array1, size);

cout << "reduced array = " << array1 << endl; cout << "reduced array size = " << size << endl; }

void deleteRepeats( char array[], int& size ) { //complete the function }

int length( char array[]) { //complete the function //strings are terminated by a \0 //length is the position of '\0' }

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!