From 450671f5b6126ef9d7418e88e5927af2d8f13b79 Mon Sep 17 00:00:00 2001 From: KozlovDanD Date: Thu, 12 Jun 2025 16:35:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B8=20=D0=BF=D1=83=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=B2=D0=B5=D0=BA=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram.cpp | 18 ++++++++---------- histogram_internal.h | 2 +- lab03.cbp | 4 ++++ main.cpp | 12 +++++++----- text.cpp | 4 ++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/histogram.cpp b/histogram.cpp index ca1dd20..a801123 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -1,24 +1,22 @@ #include #include #include "histogram.h" - +//afasfaafasfaa 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.empty()) { + return false; + } min = numbers[0]; max = numbers[0]; for (double x : numbers) { - if (x < min) - { - min = x; - } - else if (x > max) - { - max = x; - } + if (x < min) min = x; + if (x > max) max = x; } + return true; } vector make_histogram(const vector &numbers, size_t bin_count) { diff --git a/histogram_internal.h b/histogram_internal.h index ac2f4af..3002fc6 100644 --- a/histogram_internal.h +++ b/histogram_internal.h @@ -1,4 +1,4 @@ #pragma once #include -void find_minmax(const std::vector &numbers, double &min, double &max); +bool find_minmax(const std::vector &numbers, double &min, double &max); diff --git a/lab03.cbp b/lab03.cbp index 2fe521e..b9ee886 100644 --- a/lab03.cbp +++ b/lab03.cbp @@ -40,6 +40,10 @@