From e6ce0250e4809a2d3f27c97eefdb0d01874fea03 Mon Sep 17 00:00:00 2001 From: KuzmenkoEA Date: Sun, 5 May 2024 20:17:03 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.cpp b/main.cpp index 97b642e..8cb87be 100644 --- a/main.cpp +++ b/main.cpp @@ -1,38 +1,38 @@ #include #include +#include #include "histogram.h" #include "text.h" #include "svg.h" - using namespace std; -struct Input { +struct Input +{ vector numbers; size_t bin_count{}; }; -Input -input_data() { +Input input_data() +{ size_t number_count; - cout << "Enter number count: "; cin >> number_count; Input in; in.numbers.resize(number_count); vector numbers(number_count); for (size_t i = 0; i < number_count; i++) - { - cin >> in.numbers[i]; - } + {cin >> in.numbers[i];} size_t bin_count; - cout << "Enter count bin : "; cin >> in.bin_count; return in; } -int main(){ +int main() +{ + const size_t SCREEN_WIDTH = 80; + const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; auto in = input_data(); - auto bins = make_histogram(in.numbers, in.bin_count); - show_histogram_text(bins); - return 0; + const std::vector bins = make_histogram(in.numbers, in.bin_count); + show_histogram_svg(bins); + return 0; }