From 8bd08a868478009948cd112e470446d637856e13 Mon Sep 17 00:00:00 2001
From: DmitriyevDM <dmitriyevdm@mpei.ru>
Date: Sat, 3 May 2025 16:10:30 +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 +++++++-
 lab01.cbp     | 7 +++++++
 main.cpp      | 3 ++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/histogram.cpp b/histogram.cpp
index 5d85960..641db08 100644
--- a/histogram.cpp
+++ b/histogram.cpp
@@ -3,8 +3,14 @@
 using namespace std;
 
 void find_minmax(const vector<double>& 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/lab01.cbp b/lab01.cbp
index d541ad7..e7b48a0 100644
--- a/lab01.cbp
+++ b/lab01.cbp
@@ -32,7 +32,14 @@
 			<Add option="-Wall" />
 			<Add option="-fexceptions" />
 		</Compiler>
+		<Unit filename="histogram.cpp" />
+		<Unit filename="histogram.h" />
+		<Unit filename="histogram_internal.h" />
 		<Unit filename="main.cpp" />
+		<Unit filename="svg.cpp" />
+		<Unit filename="svg.h" />
+		<Unit filename="text.cpp" />
+		<Unit filename="text.h" />
 		<Extensions>
 			<lib_finder disable_auto="1" />
 		</Extensions>
diff --git a/main.cpp b/main.cpp
index 1457c4c..7e40a09 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,6 +2,7 @@
 #include <vector>
 #include "histogram.h"
 #include "text.h"
+#include "svg.h"
 using namespace std;
 
 struct Input {
@@ -29,6 +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;
 }