From cb98177a87edcfe0bf7269044d20853d5123d787 Mon Sep 17 00:00:00 2001 From: ShchipkovMY Date: Wed, 13 Sep 2023 12:40:17 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 7 +++++-- svg.cpp | 16 ++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index faea961..5167e89 100644 --- a/main.cpp +++ b/main.cpp @@ -14,11 +14,13 @@ struct Input }; Input -input_data(istream& in) +input_data(istream& in, bool prompt) { size_t number_count; + if (prompt) cerr<<"Enter number count: "; in >> number_count; + if (prompt) cerr << "Enter numbers : " << endl; Input ik; @@ -27,6 +29,7 @@ input_data(istream& in) { cin >> ik.numbers[i]; } + if (prompt) cerr<< "Enter bin count: "; cin >> ik.bin_count; return ik; @@ -34,7 +37,7 @@ input_data(istream& in) int main() { - auto in = input_data(cin); + auto in = input_data(cin, true); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins); getch(); diff --git a/svg.cpp b/svg.cpp index 4edb6d8..7ce317f 100644 --- a/svg.cpp +++ b/svg.cpp @@ -4,21 +4,9 @@ #include #include #include "svg.h" -//#include "sr.h" - -//using namespace std; -// -//double sr(const vector& bins) { -// size_t totalHeight = 0; -// for (size_t bin : bins) { -// totalHeight += bin; -// } -// -// return static_cast(totalHeight) / bins.size(); -//} - - +#include "sr.h" +using namespace std; void svg_begin(double width, double height)