From 30a95a681125f5721f4d0826aa903971c10bb114 Mon Sep 17 00:00:00 2001 From: VinogradovMA Date: Thu, 1 May 2025 01:46:49 +0300 Subject: [PATCH] code:svg_2[5] --- main.cpp | 7 +++---- svg.cpp | 4 ++++ svg.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 7831470..fc52f27 100644 --- a/main.cpp +++ b/main.cpp @@ -17,7 +17,7 @@ int main() Input in = input_data(); std::vector bins = make_histogram(in.numbers, in.bin_count); - show_histogram_text(bins, in.bin_count); + show_histogram_svg(bins); return 0; } Input input_data() { @@ -27,15 +27,14 @@ Input input_data() { cin >> countOfNumbers; input_struct.numbers.resize(countOfNumbers); - - cerr << "Input bin count:\n"; - cin >> input_struct.bin_count; cerr << "Input numbers:\n"; for (int i = 0; i < countOfNumbers; i++) { cerr << i << ":" << endl; cin >> input_struct.numbers[i]; } cerr << endl; + cerr << "Input bin count:\n"; + cin >> input_struct.bin_count; return input_struct; } diff --git a/svg.cpp b/svg.cpp index adff469..53d2e85 100644 --- a/svg.cpp +++ b/svg.cpp @@ -14,5 +14,9 @@ void svg_end() { void show_histogram_svg(const std::vector& bins) { svg_begin(400, 300); + svg_text(20, 20, std::to_string(bins[0])); svg_end(); } +void svg_text(double left, double baseline, std::string text) { + std::cout << "anything you want"; +} diff --git a/svg.h b/svg.h index 8e75041..0fc0c1c 100644 --- a/svg.h +++ b/svg.h @@ -6,5 +6,6 @@ void svg_begin(double width, double height); void svg_end(); void show_histogram_svg(const std::vector& bins); +void svg_text(double left, double baseline, std::string text); #endif // SVG_H_INCLUDED