From 387c7255d30e508715ab44c3fdf4fbc17cd993bd Mon Sep 17 00:00:00 2001 From: ShinkarenkoVA Date: Sun, 21 Apr 2024 23:13:04 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=B2=D0=B5=D1=81=D1=8C=20=D1=81=D0=BF=D0=B5=D1=86?= =?UTF-8?q?=D0=B8=D1=84=D0=B8=D1=87=D0=BD=D1=8B=D0=B9=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=D0=B0=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/main.cpp b/main.cpp index fcd24a2..1dd5179 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,7 @@ using namespace std; int main() { const size_t MAX_ELEMENT = 76; - double number_count; + size_t number_count; cerr << "Enter number count: "; cin >> number_count; @@ -18,7 +18,7 @@ int main() cin >> numbers[i]; } - double bin_count; + size_t bin_count; cerr << "Enter bin count: "; cin >> bin_count; @@ -68,29 +68,19 @@ int main() height[j] = MAX_ELEMENT * (bins[j]/max_count); } - char draw_sym; - cerr << "Please, select a symbol to draw: "; - cin >> draw_sym; - char axis_sym; - cerr << "Please, select a symbol for an axis: "; - cin >> axis_sym; - char space_sym; - cerr << "Please, select a symbol to indicate space: "; - cin >> space_sym; - if (max_count > MAX_ELEMENT){ for (size_t j=0; j < bin_count; j++) { if (bins[j] < 100) { - cout << space_sym; + cout << " "; if (bins[j] < 10){ - cout << space_sym; + cout << " "; } } - cout << bins[j] << axis_sym; + cout << bins[j] << "|"; for (size_t i=0; i < height[j]; i++){ - cout << draw_sym; + cout << "*"; } cout << endl; } @@ -99,15 +89,15 @@ int main() for (size_t j=0; j < bin_count; j++) { if (bins[j] < 100) { - cout << space_sym; + cout << " "; if (bins[j] < 10){ - cout << space_sym; + cout << " "; } } - cout << bins[j] << axis_sym; + cout << bins[j] << "|"; for (size_t i=0; i < bins[j];i++){ - cout << draw_sym; + cout << "*"; } cout << endl; }