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& 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 @@ + + + + + + + diff --git a/main.cpp b/main.cpp index 1457c4c..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,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; }