From b817e966c508ce1766cf64f34a7bad9d5545e568 Mon Sep 17 00:00:00 2001 From: DevyatovaMY <DevyatovaMY@mpei.ru> Date: Sat, 25 May 2024 14:05:20 +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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 1c98e8f..a8dadcb 100644 --- a/main.cpp +++ b/main.cpp @@ -12,10 +12,12 @@ struct Input }; Input -input_data(istream& stream) +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); @@ -23,14 +25,16 @@ input_data(istream& stream) { stream >> in.numbers[i]; } - cerr << "Enter bin count: "; + if (prompt) { + cerr << "Enter bin count: "; + } stream >> in.bin_count; return in; } int main() { - Input in = input_data(cin); + Input in = input_data(cin, true); vector<size_t> bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins); }