From f31148209915ac0372cc33dff5c482b2d23161a3 Mon Sep 17 00:00:00 2001 From: victoriaCS Date: Fri, 26 Sep 2025 22:30:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..916d001 --- /dev/null +++ b/main.cpp @@ -0,0 +1,44 @@ +#include +#include +#include "histogram.h" +#include "svg.h" + +using namespace std; + +struct Input{ + vector numbers; + size_t bin_count{}; + +}; + + +Input input_data(istream& in, bool prompt=false) { + size_t number_count; + if (prompt){ + cerr << "Enter number count: "; + } + in >> number_count; + + Input result; // Объявляем переменную типа Input, которую будем возвращать + result.numbers.resize(number_count); + + for (size_t i = 0; i < number_count; ++i) { + in >> result.numbers[i]; + } + if (prompt){ + cerr << "Enter bin count: "; + } + in >> result.bin_count; + return result; // Возвращаем заполненную структуру Input +} + + + +int main(){ + + auto in = input_data(cin); + auto bins = make_histogram(in.numbers, in.bin_count); + show_histogram_svg(bins); + + +}