Question: Q1) A) B) Please write in C++ Write a program that asks for a string. Then, it populates the elements of an integer array to

Q1)

A) Q1) A) B) Please write in C++ Write a program that asks

B) for a string. Then, it populates the elements of an integer array

Please write in C++

Write a program that asks for a string. Then, it populates the elements of an integer array to keep track of the counts of each character in the given string. To make it simple, the string only contains alphabetical characters from a to z and from A to Z. After getting the counts, print the characters(first uppercase and then lowercase) and their counts from the array that you created in the alphabetical order, if they occur at least once in the string (in other words the value of the element of the array is higher than zero). Hint: You can create an integer array of size 26 and use the positions of the array to keep track of the respective alphabet's count. For example: Test Input Result //test case 1 Colorado Enter a word C: 1 a: 1 d: 1 l: 1 o: 3 r: 1 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 vowel Count = 4; numChars = insert(str, numChars, size, vowelCount); printArray(str, numChars)

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!