From 5e203b38414ecd75d45f650d0c11d6e2521c5698 Mon Sep 17 00:00:00 2001 From: KlimecnhenkoIA Date: Mon, 26 May 2025 04:23:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B0=D0=BB=D0=B5=D0=BD=D1=8C=D0=BA?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram.cpp | 8 +++++++- lab34.cbp | 3 +++ main.cpp | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/histogram.cpp b/histogram.cpp index fa94a91..07a94c3 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -3,8 +3,14 @@ using namespace std; void find_minmax(const vector& numbers, double& min, double& max) { + if (numbers.empty()) + { + min = 0; + max = 0; + return; + } max = numbers[0]; - min = numbers[1]; + min = numbers[0]; for (double x : numbers) { if (x < min) min = x; else if (x > max) max = x; diff --git a/lab34.cbp b/lab34.cbp index 0c0e7e4..80d1452 100644 --- a/lab34.cbp +++ b/lab34.cbp @@ -32,7 +32,10 @@ + + + diff --git a/main.cpp b/main.cpp index 4ffe988..7e40a09 100644 --- a/main.cpp +++ b/main.cpp @@ -2,6 +2,7 @@ #include #include "histogram.h" #include "text.h" +#include "svg.h" using namespace std; struct Input { @@ -29,5 +30,6 @@ Input input_data() { int main() { auto in = input_data(); auto bins = make_histogram(in.numbers, in.bin_count); - show_histogram_text(bins, in.bin_count); + show_histogram_svg(bins); + return 0; }