From 6137e81f173712a9af75914f300d129910b07dbf Mon Sep 17 00:00:00 2001 From: "Ivan (BeloziorovIA)" Date: Mon, 5 May 2025 13:38:14 +0300 Subject: [PATCH] =?UTF-8?q?build:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B2=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B3=D0=B8=D1=81=D1=82=D0=BE=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D0=BC=D0=BC=D1=8B=20=D0=B2=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=20SVG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 8 ++++---- svg.cpp | 33 +++++++++++++++++++++++++++++++++ svg.h | 12 ++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 svg.cpp create mode 100644 svg.h diff --git a/main.cpp b/main.cpp index 6369c34..ffa2df8 100644 --- a/main.cpp +++ b/main.cpp @@ -5,10 +5,9 @@ #include #include "histogram.h" #include "text.h" +#include "svg.h" using namespace std; -//!Разделить программу на файлы (3 пункт)! - //Создание структуры Input для входных данных struct Input { vector Numbers; @@ -26,7 +25,7 @@ Input input_data(){ vector Numbers(number_count); stct.Numbers.resize(number_count); cerr << "Enter array:\n"; - cin >> Numbers[0]; + cin >> stct.Numbers[0]; for (int i = 1; i < number_count; i++) { cin >> stct.Numbers[i]; } @@ -45,7 +44,8 @@ int main() { vector bins = make_histogram(in.Numbers, in.bin_count); //Вывод гистограммы - show_histogram_text(bins); + show_histogram_svg(bins); + //show_histogram_text(bins); return 0; } diff --git a/svg.cpp b/svg.cpp new file mode 100644 index 0000000..0246c50 --- /dev/null +++ b/svg.cpp @@ -0,0 +1,33 @@ +#include +#include "svg.h" +#include +#include + +void svg_begin(double width, double height) { + std::cout << "\n"; + std::cout << "\n"; +} + +void svg_end() { + std::cout << "\n"; +} + +void svg_text(double left, double baseline, std::string text){ + std::cout << "" << text << ""; +} + +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_rect(double x, double y, double width, double height){ + std::cout << "" +} +*/ diff --git a/svg.h b/svg.h new file mode 100644 index 0000000..cfa0484 --- /dev/null +++ b/svg.h @@ -0,0 +1,12 @@ +#ifndef SVG_H_INCLUDED +#define SVG_H_INCLUDED +#include +#include + +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); +//void svg_rect(double x, double y, double width, double height) + +#endif // SVG_H_INCLUDED