From 7de6ebe1a7425decb45f8be33d13c44de853ee08 Mon Sep 17 00:00:00 2001 From: EfimovaLA Date: Sun, 2 Jun 2024 18:19:58 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 177c8db..4e8020a 100644 --- a/main.cpp +++ b/main.cpp @@ -15,16 +15,20 @@ struct Input size_t bin_count{}; }; -Input input_data(istream& stream) +Input input_data(istream& stream, bool prompt) { size_t number_count; - cerr << "Enter number count:"; + if (prompt){ + cerr << "Enter number count:"; + } stream >> number_count; Input in; in.numbers.resize(number_count); - cerr << "Enter numbers: "; + if (prompt){ + cerr << "Enter numbers: "; + } for(size_t i = 0; i < number_count; i++) stream >> in.numbers[i]; @@ -37,10 +41,11 @@ Input input_data(istream& stream) int main() { - auto in = input_data(cin); + bool prompt = true; + auto in = input_data(cin, prompt); auto bins = make_histogram(in.numbers, in.bin_count); - // show_histogram_svg_vertical(bins); + // show_histogram_svg_vertical(bins); show_histogram_svg(bins); }