Маленькие поправки

Этот коммит содержится в:
2025-05-03 16:10:30 +03:00
родитель a3bc2607f3
Коммит 8bd08a8684
3 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@@ -3,8 +3,14 @@
using namespace std; using namespace std;
void find_minmax(const vector<double>& numbers, double& min, double& max) { void find_minmax(const vector<double>& numbers, double& min, double& max) {
if (numbers.empty())
{
min = 0;
max = 0;
return;
}
max = numbers[0]; max = numbers[0];
min = numbers[1]; min = numbers[0];
for (double x : numbers) { for (double x : numbers) {
if (x < min) min = x; if (x < min) min = x;
else if (x > max) max = x; else if (x > max) max = x;

Просмотреть файл

@@ -32,7 +32,14 @@
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
</Compiler> </Compiler>
<Unit filename="histogram.cpp" />
<Unit filename="histogram.h" />
<Unit filename="histogram_internal.h" />
<Unit filename="main.cpp" /> <Unit filename="main.cpp" />
<Unit filename="svg.cpp" />
<Unit filename="svg.h" />
<Unit filename="text.cpp" />
<Unit filename="text.h" />
<Extensions> <Extensions>
<lib_finder disable_auto="1" /> <lib_finder disable_auto="1" />
</Extensions> </Extensions>

Просмотреть файл

@@ -2,6 +2,7 @@
#include <vector> #include <vector>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg.h"
using namespace std; using namespace std;
struct Input { struct Input {
@@ -29,6 +30,6 @@ Input input_data() {
int main() { int main() {
auto in = input_data(); auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_text(bins, in.bin_count); show_histogram_svg(bins);
return 0; return 0;
} }