diff --git a/histogram.cpp b/histogram.cpp index b91f450..898675d 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -1,8 +1,12 @@ #include "histogram.h" +#include "histogram_internal.h" using namespace std; -void find_minmax(const vector& numbers, double& min, double& max) { +bool find_minmax(const vector& numbers, double& min, double& max) { + if (numbers.size() == 0) { + return false; + } min = numbers[0]; max = numbers[0]; for (double x : numbers) { @@ -13,6 +17,7 @@ void find_minmax(const vector& numbers, double& min, double& max) { max = x; } } + return true; } vector make_histogram(const vector &numbers, size_t bin_count) { vector bins(bin_count);