From 203a56df5bc3f0fec59f53eeb943fd84b5f5733b Mon Sep 17 00:00:00 2001 From: StepanishchevVR Date: Tue, 21 May 2024 19:30:15 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 686b402..b44b80a 100644 --- a/main.cpp +++ b/main.cpp @@ -12,11 +12,13 @@ struct Input size_t bin_count{}; }; -Input input_data(istream& stream) +Input input_data(istream& stream, bool prompt) { Input in; size_t number_count; - cerr << "Enter num count >>"; + if (prompt){ + cerr << "Enter num count >>"; + } stream >> number_count; in.numbers.resize(number_count); @@ -25,7 +27,9 @@ Input input_data(istream& stream) { stream >> in.numbers[i]; } - cerr << "Enter bin count >>"; + if (prompt){ + cerr << "Enter bin count >>"; + } stream >> in.bin_count; return in; } @@ -33,7 +37,7 @@ Input input_data(istream& stream) int main() { bool prompt = true; - auto in = input_data(cin); + auto in = input_data(cin, prompt); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins); }