Exercise 3: Finding Index of the Smallest Value
Find the index of the smallest value in an array.
We'll cover the following...
We'll cover the following...
Problem statement
The code widget below declares two index_of_smallest functions—one for finding the index of the smallest value in an int array, and the other for a double array.
Define a template class type function index_of_smallest that generalizes the function such that it finds the minimum value index for both int and double type array input values. The function for finding the index of the smallest value in an array takes the following two values:
Array of values
Size of array
Note: Remove both the
intanddoubletypeindex_of_smallestfunctions and then write the code for the template class typeindex_of_smallestfunction there.