From 57140889ada6fd7874483985523889e2d96a5ece Mon Sep 17 00:00:00 2001 From: LedovskojMM Date: Sun, 23 Apr 2023 23:36:56 +0300 Subject: [PATCH] ERROR --- histogam.cpp | 1 + lab1.depend | 25 ++++++++++++++++++++++--- main.cpp | 8 +++++--- svg.cpp | 37 +++++++++++++++++++++++++++++++++++++ svg.h | 7 +++++++ text.cpp | 1 + 6 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 svg.cpp create mode 100644 svg.h diff --git a/histogam.cpp b/histogam.cpp index 25ee82b..ca73087 100644 --- a/histogam.cpp +++ b/histogam.cpp @@ -3,6 +3,7 @@ #include #include "histogam.h" #include "histogam_internal.h" +#include using namespace std; void find_minmax(vector numbers, double& min, double& max) { diff --git a/lab1.depend b/lab1.depend index 5f3bc1d..9a01243 100644 --- a/lab1.depend +++ b/lab1.depend @@ -3,28 +3,47 @@ -1682273505 source:c:\users\admin\onedrive\Рабочий стол\lab1\main.cpp +1682281166 source:c:\users\admin\onedrive\Рабочий стол\lab1\main.cpp + "histogam.h" "text.h" + "svg.h" + 1682273839 c:\users\admin\onedrive\Рабочий стол\lab1\histogam.h -1682273664 source:c:\users\admin\onedrive\Рабочий стол\lab1\histogam.cpp +1682280773 source:c:\users\admin\onedrive\Рабочий стол\lab1\histogam.cpp "histogam.h" + "histogam_internal.h" + -1682273357 source:c:\users\admin\onedrive\Рабочий стол\lab1\text.cpp +1682280773 source:c:\users\admin\onedrive\Рабочий стол\lab1\text.cpp "text.h" + 1682273447 c:\users\admin\onedrive\Рабочий стол\lab1\text.h +1682273796 c:\users\admin\onedrive\Рабочий стол\lab1\histogam_internal.h + + +1682280585 source:c:\users\admin\onedrive\Рабочий стол\lab1\svg.cpp + + + + + + "svg.h" + +1682280301 c:\users\admin\onedrive\Рабочий стол\lab1\svg.h + diff --git a/main.cpp b/main.cpp index 49fb625..cbc6fa6 100644 --- a/main.cpp +++ b/main.cpp @@ -1,8 +1,11 @@ #include #include #include +#include #include "histogam.h" #include "text.h" +#include "svg.h" +#include using namespace std; @@ -32,7 +35,6 @@ int main() { Input in = input_data(); auto bins = make_histogram(in.numbers, in.bin_count); - show_histogram_text(bins, in.bin_count); - - + show_histogram_svg(bins); + return 0; } diff --git a/svg.cpp b/svg.cpp new file mode 100644 index 0000000..f32c103 --- /dev/null +++ b/svg.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include +#include "svg.h" +using namespace std; + + +void +svg_begin(double width, double height) { + cout << "\n"; + cout << "\n"; +} + +void +svg_end() { + cout << "\n"; +} +void +svg_text(double left, double baseline, string text) { + cout << "" << text << ""; +} + + + + +void +show_histogram_svg(const vector& bins) { + svg_begin(400, 300); + svg_text(20, 20, to_string(bins[0])); + svg_end(); +} diff --git a/svg.h b/svg.h new file mode 100644 index 0000000..ac36df3 --- /dev/null +++ b/svg.h @@ -0,0 +1,7 @@ +#ifndef SVG_H_INCLUDED +#define SVG_H_INCLUDED + +void +show_histogram_svg(const std::vector& bins); + +#endif // SVG_H_INCLUDED diff --git a/text.cpp b/text.cpp index d44d87e..8ed839d 100644 --- a/text.cpp +++ b/text.cpp @@ -2,6 +2,7 @@ #include #include #include "text.h" +#include using namespace std; void show_histogram_text(vector bins, size_t bin_count ) {