Assume that the class Frac
is implemented in the same way as in the notes. Create the function indexOfSmallestFraction
with two arguments a
and n
. The argument a
is the pointer to a block of n
consecutive memory locations that contain fractions. The function should return the index i
for which the number a[i]
is the smallest among the fractions a[0]
, a[1]
, ...
, a[n-1]
. Your code should replace the text // ??? //
below.
long indexOfSmallestFraction(Frac* a, long n){ // ??? // }