From 15b6a7b9c5582625fdac5d001c74b900f387aff8 Mon Sep 17 00:00:00 2001 From: MokeevNV Date: Thu, 1 May 2025 18:47:24 +0300 Subject: [PATCH] =?UTF-8?q?code:=204.=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D1=8B(=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20find=5Fminma?= =?UTF-8?q?x=20=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D1=83=D1=8E=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20=D0=B8=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20histogram=5Finternal.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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);