Solved by verified expert:1) Write a c++ program that contains the following functionsa) A function that takes in an integer array of any size, and fills up the array with values taken from the user. (Your function should work for any size array, and should be tested with at least 3 arrays of different sizes)b) Do the same as a) above, but get the values from a file instead. (Create a file that has input for at least 3 arrays of different sizes).c) A function that takes in an array of any size, and returns the sum of all multiples of 5 in the array.d) A function that takes in an array of any size and an integer key m. It should return the mth smallest element in the array. (m cannot be larger than the size of the array, and your array should be unsorted).For example for an array containing 3 2 4 8 9 6, and m is 2, it should return the 2nd smallest number in the array which is 3e) A function that takes in an array of any size and a key, and returns the number of passes it takes to find the key in the array or 0 if it’s not in the array. Use Binary Searchf) A function that takes in an array of any size and prints the content 4 per line. (Test this function with at least 3 arrays of different sizes)Optional Question (Practice)Write the definition of a function that takes in any array of any size, and an integer key, and returns the smallest value closest to they key if it is in the array, returns 0 otherwise (Use Binary Search)Example6, 11, 15, 24 29 35 49 61 75 83. is contained in an array, with a key of 49, the smallest value closest to 49 is 35, and your function returns that.2) Write a C++ program that reads from a file the last name of an election candidate and the number of votes that they received, you program would then determine what percentage of vote each candidate received and the winner of the election. Use the concept of parallel arrays. Your program should contain the following functionsa) A function to read in the data from the file into the appropriate data structureb) A function to calculate each candidates percentage of vote earnedc) A function to print out each candidate’s name, number of votes and percentage of total vote earned (Output should be formatted to look like the file, with a new header for vote percent)d) A function that returns the name of the election winner.Use appropriate function calls to test your program. Below is the content of the file. ignore the first line containing the headers if it makes it easier to writeCandidate Number of VotesLannister 350000Stark 310000Targaryen 397000Baratheon 275000Martell 280000Greyjoy 205000Mormont 415000Tully 30000(Feel free to adjust the numbers in the file)there is two more questios in the attachments
img_4478.jpg
img_4477.jpg
Unformatted Attachment Preview
…
Purchase answer to see full
attachment


