From d3e9f506137530d597acfabb42dc709c8ebe8a89 Mon Sep 17 00:00:00 2001 From: BezhenarAN Date: Sun, 19 May 2024 12:14:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=83=D0=BD=D0=BA=D1=82=204.1:=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BF=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=BA=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 | 14 ++++++-------- unittest_svg.cbp | 6 ++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index b412814..ff9ad0a 100644 --- a/main.cpp +++ b/main.cpp @@ -13,28 +13,28 @@ struct Input { double USER_BIN_HEIGHT{}; }; -Input input_data() { +Input input_data(istream& stream) { size_t number_count; cerr << "Enter number count: "; - cin >> number_count; + stream >> number_count; Input in; cerr << "Enter number of bins: "; - cin >> in.bin_count; + stream >> in.bin_count; in.numbers.resize(number_count); cerr << "Enter numbers: "; for (size_t i = 0; i < number_count; i++) { - cin >> in.numbers[i]; + stream >> in.numbers[i]; } cerr << "Enter image height: "; - cin >> in.USER_BIN_HEIGHT; + stream >> in.USER_BIN_HEIGHT; return in; } @@ -44,9 +44,7 @@ Input input_data() { int main(){ - bool res = false; - - Input in = input_data(); + Input in = input_data(cin); auto bins = make_histogram(in.numbers, in.bin_count); diff --git a/unittest_svg.cbp b/unittest_svg.cbp index 7b79d3f..d90244d 100644 --- a/unittest_svg.cbp +++ b/unittest_svg.cbp @@ -31,6 +31,12 @@ + + + + +