diff --git a/histogram.cpp b/histogram.cpp index 7108c06..05d848e 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -4,6 +4,11 @@ using namespace std; void find_minmax(const vector& numbers, double& min, double& max) { + if (numbers.empty()) { + min = 0; + max = 0; + return; + } min = numbers[0]; max = numbers[0]; for (float x : numbers) {