diff --git a/Histogram/Histogram.cbp b/Histogram/Histogram.cbp
index 208a284..08b30d2 100644
--- a/Histogram/Histogram.cbp
+++ b/Histogram/Histogram.cbp
@@ -13,6 +13,7 @@
+
@@ -27,6 +28,7 @@
+
@@ -39,6 +41,7 @@
+
diff --git a/Histogram/Histogram.depend b/Histogram/Histogram.depend
new file mode 100644
index 0000000..5a2177c
--- /dev/null
+++ b/Histogram/Histogram.depend
@@ -0,0 +1,91 @@
+# depslib dependency file v1.0
+1747595453 source:c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\main.cpp
+
+
+ "histogram.h"
+ "text.h"
+
+
+
+
+1745795032 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\histogram.h
+
+
+1745791758 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\text.h
+
+
+1747164718 source:c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\svg.cpp
+ "svg.h"
+
+
+
+
+1745841059 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\svg.h
+
+
+
+
+1746443355 source:c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\text.cpp
+ "text.h"
+
+
+
+1745841101 source:c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\histogram.cpp
+ "histogram.h"
+
+
+ "svg.h"
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\curl.h
+ "curlver.h"
+ "system.h"
+
+
+
+
+
+
+
+
+
+
+ "easy.h"
+ "multi.h"
+ "urlapi.h"
+ "options.h"
+ "header.h"
+ "websockets.h"
+ "mprintf.h"
+ "typecheck-gcc.h"
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\curlver.h
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\system.h
+
+
+
+
+
+
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\easy.h
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\multi.h
+ "curl.h"
+
+1747048791 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\urlapi.h
+ "curl.h"
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\options.h
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\header.h
+
+1747048791 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\websockets.h
+
+1747048790 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\mprintf.h
+
+
+ "curl.h"
+
+1747048791 c:\users\yaros_tm2sc6p\Рабочий стол\cs-lab34\histogram\curl\include\curl\typecheck-gcc.h
+
diff --git a/Histogram/Histogram.layout b/Histogram/Histogram.layout
index f539b74..fa64b1a 100644
--- a/Histogram/Histogram.layout
+++ b/Histogram/Histogram.layout
@@ -2,34 +2,44 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
diff --git a/Histogram/bin/Debug/Histogram.exe b/Histogram/bin/Debug/Histogram.exe
index 7b5405f..531a8e7 100644
Binary files a/Histogram/bin/Debug/Histogram.exe and b/Histogram/bin/Debug/Histogram.exe differ
diff --git a/Histogram/histogram.cpp b/Histogram/histogram.cpp
index e61b64e..5b7d71c 100644
--- a/Histogram/histogram.cpp
+++ b/Histogram/histogram.cpp
@@ -1,6 +1,7 @@
#include "histogram.h"
#include
-#include
+#include
+#include "svg.h"
size_t find_minmax(const std::vector& numbers, double& min, double& max) {
if (numbers.empty()) {
@@ -27,34 +28,15 @@ std::vector make_histogram(const std::vector& numbers, size_t bi
double min, max;
find_minmax(numbers, min, max);
if (max == min) {
- return bins; // Возвращаем пустые корзины, findтак как гистограмма не может быть построена
+ return bins;
}
double bin_width = (max - min) / bin_count;
for (double number : numbers) {
size_t bin_index = static_cast((number - min) / bin_width);
if (bin_index >= bin_count) {
- bin_index = bin_count - 1; // Обработка крайнего случая max == number
+ bin_index = bin_count - 1;
}
bins[bin_index]++;
}
return bins;
};
-
-void show_histogram_svg(const std::vector& bins) {
- const auto IMAGE_WIDTH = 400;
- const auto IMAGE_HEIGHT = 300;
- const auto TEXT_LEFT = 20;
- const auto TEXT_BASELINE = 20;
- const auto TEXT_WIDTH = 50;
- const auto BIN_HEIGHT = 30;
- const auto BLOCK_WIDTH = 10;
-
- svg_begin(IMAGE_WIDTH, IMAGE_HEIGHT);
- for (size_t i = 0; i < bins.size(); ++i) {
- const double bin_width = BLOCK_WIDTH * bins[i];
- const double top = i * BIN_HEIGHT;
- svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
- svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#aaffaa"); // Пример цвета
- }
- svg_end();
-}
diff --git a/Histogram/main.cpp b/Histogram/main.cpp
index f463122..6a55310 100644
--- a/Histogram/main.cpp
+++ b/Histogram/main.cpp
@@ -39,11 +39,9 @@ Input input_data(std::istream& in, bool prompt) {
using namespace std;
int main(int argc, char* argv[]) {
+ curl_global_init(CURL_GLOBAL_ALL);
if (argc>1){
- cerr << "argc = " << argc << endl;
- for (int i=0; i < argc; ++i){
- cerr << "argv[" << i << "] = " << argv[i] << endl;
- }
+
return 0;
}
Input in = input_data(std::cin, true);
diff --git a/Histogram/obj/Debug/main.o b/Histogram/obj/Debug/main.o
index 1b151e3..ac8ea90 100644
Binary files a/Histogram/obj/Debug/main.o and b/Histogram/obj/Debug/main.o differ
diff --git a/Histogram/svg.cpp b/Histogram/svg.cpp
index 02a4501..568148b 100644
--- a/Histogram/svg.cpp
+++ b/Histogram/svg.cpp
@@ -1,6 +1,7 @@
#include "svg.h"
#include
#include
+#include
void svg_begin(double width, double height) {
std::cout << "\n";
@@ -16,9 +17,30 @@ void svg_end() {
}
void svg_rect(double x, double y, double width, double height, std::string stroke, std::string fill) {
- std::cout << "\n";
+ std::cout << "\n";
}
void svg_text(double left, double baseline, std::string text) {
std::cout << "" << text << "\n";
}
+void show_histogram_svg(const std::vector& bins) {
+ const auto IMAGE_WIDTH = 400;
+ const auto IMAGE_HEIGHT = 300;
+ const auto TEXT_LEFT = 20;
+ const auto TEXT_BASELINE = 20;
+ const auto TEXT_WIDTH = 50;
+ const auto BIN_HEIGHT = 30;
+ const auto BLOCK_WIDTH = 10;
+
+ svg_begin(IMAGE_WIDTH, IMAGE_HEIGHT);
+ for (size_t i = 0; i < bins.size(); ++i) {
+ const double bin_width = BLOCK_WIDTH * bins[i];
+ const double top = i * BIN_HEIGHT;
+ svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
+ svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#aaffaa");
+ }
+ svg_end();
+}
+
+
+
diff --git a/Histogram/svg.h b/Histogram/svg.h
index e3d2aa7..7610b4d 100644
--- a/Histogram/svg.h
+++ b/Histogram/svg.h
@@ -7,3 +7,4 @@ void svg_begin(double width, double height);
void svg_end();
void svg_rect(double x, double y, double width, double height, std::string stroke = "black", std::string fill = "black");
void svg_text(double left, double baseline, std::string text);
+void show_histogram_svg(const std::vector& bins);
diff --git a/Histogram/svg.o b/Histogram/svg.o
new file mode 100644
index 0000000..3f134fa
Binary files /dev/null and b/Histogram/svg.o differ
diff --git a/Histogram/text.cpp b/Histogram/text.cpp
index 6172155..16cf37b 100644
--- a/Histogram/text.cpp
+++ b/Histogram/text.cpp
@@ -24,4 +24,7 @@ void show_histogram_text(const std::vector& bins) {
}
std::cout << "\n";
}
+}
};
+
+