Question: array c++ int replaceAll( string array1[ ], int n, char letterToReplace, char letterToFill ); This function should replace every occurrence of the letterToReplace value with

array c++

int replaceAll( string array1[ ], int n, char letterToReplace, char letterToFill ); This function should replace every occurrence of the letterToReplace value with the letterToFill value found in all the array elements of the passed array argument. Return the number of letters that were replaced or -1 if the array has no elements. For example, for the array people[ 5 ] shown above, replaceAll( people, 5, 'z', 'a' ) should return 0 and the array argument should be unchanged. However, replaceAll( people, -5, 'z', 'a' ) should return -1. And finally, for the array string data[ 4 ] = { "happy", "days", "are here", "again" }; replaceAll( data, 4, 'a', 'z' ) should return the value 5 and the array argument should be changed to: { "hzppy", "dzys", "zre here", "zgzin" };

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!