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