Commit b211cc0d authored by Michael's avatar Michael

michael.davityan:exercise_07_37v7

parent bb569f37
Minimum is: 2
Minimum is: 12.5
Minimum is: -3
Minimum is: 0.05
Minimum is: a
5
2 3 5 7 9
7
-3
4
12
9
5
12.5
14.5
0.05
1.5
7.5
5
12.5 23.4 67.1 32.25 89.96
6
cadbe
#include <iostream>
#include <iomanip>
#include <unistd.h>
#include <limits>
template <typename T>
T
recursiveMinimum(const T array[], const size_t sizeOfArray, T minimum)
recursiveMinimum(const T array[], const size_t sizeOfArray, T minimum = std::numeric_limits<T>::max())
{
if (0 == sizeOfArray) {
return array[sizeOfArray];
return minimum;
}
if (array[sizeOfArray] < array[sizeOfArray -1]) {
array[sizeOfArray - 1] = array[sizeOfArray];
if (minimum > array[sizeOfArray]) {
minimum = array[sizeOfArray];
}
return recursiveMinimum(array, sizeOfArray - 1);
return recursiveMinimum(array, sizeOfArray - 1, minimum);
}
template <typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment