From 7d41e081ce602ca754afc2dc57665bb8ffe84b4d Mon Sep 17 00:00:00 2001 From: AnisenkovPD Date: Sat, 25 May 2024 00:13:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B2=D0=B2=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index 8c810cf..a28a84d 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include "histogram.h" #include "text.h" +#include "svg.h" using namespace std; const size_t SCREEN_WIDTH = 80; const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; @@ -13,17 +14,17 @@ struct Input { }; Input -input_data() { +input_data(istream& in) { size_t number_count; - cin >> number_count; - Input in; - in.numbers.resize(number_count); + in >> number_count; + Input inn; + inn.numbers.resize(number_count); for (size_t i = 0; i < number_count; i++) { - cin >> in.numbers[i]; + in >> inn.numbers[i]; } size_t bin_count; - cin >> in.bin_count; - return in; + in >> inn.bin_count; + return inn; } @@ -34,9 +35,9 @@ input_data() { int main() { - auto in = input_data(); + auto in = input_data(cin); auto bins = make_histogram(in.numbers, in.bin_count); - show_histogram_text(bins); + show_histogram_svg(bins); return 0; }