From 2d0d2dc8896bc70188a9e5cc12f8146e44306c82 Mon Sep 17 00:00:00 2001 From: ChirkaAR Date: Thu, 21 Aug 2025 13:04:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram.cpp | 8 +++++++- histogram_internal.h | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/histogram.cpp b/histogram.cpp index 0b5f9d1..9637586 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -3,8 +3,13 @@ #include using namespace std; -void find_minmax(const vector& numbers, double& minN, double& maxN) +//std::vector +bool find_minmax(const vector& numbers, double& minN, double& maxN) { + if (numbers.empty()) { + minN = maxN = 0; + return false; + } minN = numbers[0]; maxN = numbers[0]; @@ -19,6 +24,7 @@ void find_minmax(const vector& numbers, double& minN, double& maxN) maxN = x; } } + return true; } vector make_histogram(const vector& numbers, size_t bin_count) diff --git a/histogram_internal.h b/histogram_internal.h index 54abeff..94c5561 100644 --- a/histogram_internal.h +++ b/histogram_internal.h @@ -3,7 +3,7 @@ #include -std::vector -find_minmax( const std::vector& numbers, double& minN, double& maxN); +//std::vector +bool find_minmax(const std::vector& numbers, double& minN, double& maxN); #endif // HISTOGRAM_INTERNAL_H_INCLUDED