Question: in C++ Write a function insert that takes four parameters, in this order: an array of characters, the number of characters currently in the array,

in C++
Write a function insert that takes four parameters, in this order: an array of characters, the number of characters currently in the array, the total size of the array, and the number of vowels in the array. The function should traverse the character array, and when it finds a vowel it should insert the same vowel directly after it in the array. If the array is already full or if the number of characters that need to be added to the array exceeds the total size of the array, the array should remain unchanged. The function should return the new number of characters in the array. Assume all inputs are lowercase alphabets. Function specifications: The function name: insert . The function parameters (in this order): An array, char[] o The number of characters stored in the array, int The size of the array, int o The number of vowels in the array, int The function returns the total number of characters in the array after the insertion. For example: Test Result miissiissiippii // test case2 char str [15] = "mississippi"; int numChars = 11; int size = 15; int vowelCount = 4; numChars = insert(str, numChars, size, vowelCount); printArray(str, numChars); Answer: (penalty regime: 0 %) Reset answer 1 V Only put the function in the answer box. 2 // Header files: iostream, iomanip have been already included 3 // If you put int main(){ }, it will say error: redefinition of 'int main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
