diff --git a/histogram.h b/histogram.h index 0a87696..03d2761 100644 --- a/histogram.h +++ b/histogram.h @@ -6,6 +6,4 @@ std::vector make_histogram(const std::vector& numbers, size_t bin_count); bool find_minmax(std::vector numbers, double& minN, double& maxN); - - #endif // HISTOGRAM_H_INCLUDED diff --git a/lab03.depend b/lab03.depend index a68c170..beea0e1 100644 --- a/lab03.depend +++ b/lab03.depend @@ -1,13 +1,13 @@ # depslib dependency file v1.0 -1746452588 source:c:\users\koldinad\desktop\lab03\histogram.cpp +1748102935 source:c:\users\koldinad\desktop\lab03\histogram.cpp "histogram.h" -1746451370 c:\users\koldinad\desktop\lab03\histogram.h +1748104048 c:\users\koldinad\desktop\lab03\histogram.h -1746452830 source:c:\users\koldinad\desktop\lab03\main.cpp +1748102935 source:c:\users\koldinad\desktop\lab03\main.cpp "histogram.h" @@ -17,16 +17,32 @@ 1745846054 c:\users\koldinad\desktop\lab03\text.h -1745846055 source:c:\users\koldinad\desktop\lab03\text.cpp +1748102935 source:c:\users\koldinad\desktop\lab03\text.cpp "text.h" -1746452588 c:\users\koldinad\desktop\lab03\svg.h +1748102935 c:\users\koldinad\desktop\lab03\svg.h -1746452790 source:c:\users\koldinad\desktop\lab03\svg.cpp +1748102935 source:c:\users\koldinad\desktop\lab03\svg.cpp "svg.h" +1746452588 source:c:\users\koldinad\desktop\lab34\histogram.cpp + "histogram.h" + + + +1746451370 c:\users\koldinad\desktop\lab34\histogram.h + + +1745846055 source:c:\users\koldinad\desktop\lab34\text.cpp + "text.h" + + + +1745846054 c:\users\koldinad\desktop\lab34\text.h + + diff --git a/main.cpp b/main.cpp index 2598d91..3153298 100644 --- a/main.cpp +++ b/main.cpp @@ -8,7 +8,6 @@ using namespace std; struct Input{ vector numbers; size_t bin_count{}; - size_t font_size{}; }; Input input_data() @@ -23,15 +22,6 @@ input_data() cin >> in.numbers[i]; } cin >> in.bin_count; - - size_t font_size_input = 0; - while (font_size_input < 8 || font_size_input > 32) { - cerr << "Enter font size (832, default is 12): "; - cin >> font_size_input; - cerr << "Invalid font size. Must be between 8 and 32.\n"; - } - in.font_size = font_size_input; - return in; } @@ -40,5 +30,5 @@ int main() size_t max_count; auto in = input_data(); auto bins = make_histogram(in.numbers, in.bin_count); - show_histogram_svg(bins, in.font_size); + show_histogram_svg(bins); } diff --git a/svg.cpp b/svg.cpp index b05908c..eb3fedf 100644 --- a/svg.cpp +++ b/svg.cpp @@ -2,7 +2,7 @@ #include using namespace std; -// SVG +// Функции вывода заголовка и окончания SVG void svg_begin(double width, double height) { cout << "\n"; @@ -17,24 +17,22 @@ svg_end() { cout << "\n"; } -// +//Подписи к столбцам void -svg_text(double left, double baseline, string text, size_t font_size) { - cout << "" << text << "\n"; +svg_text(double left, double baseline, string text) { + cout << "" << text << "\n"; } -// +//Вывод прямоугольника void svg_rect(double x, double y, double width, double height, string stroke = "black", string fill = "black") { cout << "\n"; } -// +//Графический вывод гистограммы void -show_histogram_svg(const vector& bins, size_t font_size) { +show_histogram_svg(const vector& bins) { const auto IMAGE_WIDTH = 400; const auto IMAGE_HEIGHT = 300; const auto TEXT_LEFT = 20; @@ -53,14 +51,10 @@ show_histogram_svg(const vector& bins, size_t font_size) { for (size_t i = 0; i < bins.size(); i++) { string color = colors[i]; const double bin_width = BLOCK_WIDTH * bins[i]; - svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bins[i]), font_size); // - svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "#ACB0EC", color); // + svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bins[i])); //вывод подписей + svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "#ACB0EC", color); //вывод столбцов top += BIN_HEIGHT; } svg_end(); } - - - - diff --git a/svg.h b/svg.h index 80c902d..cc5ea41 100644 --- a/svg.h +++ b/svg.h @@ -3,5 +3,5 @@ #include #include -void show_histogram_svg(const std::vector& bins, size_t font_size); +void show_histogram_svg(const std::vector& bins); #endif // SVG_H_INCLUDED diff --git a/unittest.depend b/unittest.depend index d517632..507ca71 100644 --- a/unittest.depend +++ b/unittest.depend @@ -59,3 +59,63 @@ 1746451281 c:\users\koldinad\desktop\lab03\histogram_internal.h +1746452588 source:c:\users\koldinad\desktop\lab34\histogram.cpp + "histogram.h" + + + +1746451370 c:\users\koldinad\desktop\lab34\histogram.h + + +1746451448 source:c:\users\koldinad\desktop\lab34\unittest.cpp + "doctest.h" + "histogram_internal.h" + +1745844730 c:\users\koldinad\desktop\lab34\doctest.h + + + + + + + "doctest_fwd.h" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1746451281 c:\users\koldinad\desktop\lab34\histogram_internal.h + +