From 3ac3cea537b0492afb9a4a3acc01b10f406872d6 Mon Sep 17 00:00:00 2001 From: "lab34 (BiriukovaAlS)" Date: Mon, 22 May 2023 01:47:16 +0300 Subject: [PATCH] text --- text.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 text.cpp diff --git a/text.cpp b/text.cpp new file mode 100644 index 0000000..fb065ee --- /dev/null +++ b/text.cpp @@ -0,0 +1,41 @@ +#include "text.h" +#include +#include + +using namespace std; +void show_histogram_text(vectorB, size_t kol_kor) +{ + + const size_t SCREEN_WIDTH = 80; + const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; + int max_count, count,j, height; + for (size_t i=0; i MAX_ASTERISK) + { + count = B[i]; + height = MAX_ASTERISK * (static_cast(count) / max_count); + } + + else + { + height = B[i]; + } + + for (j = 0; j < height; j++) + { + cout << "*"; + } + cout << endl; + } + return; +}