code: создаем гистограмму отдельно (2)

master
PodolskyNK 12 месяцев назад
Родитель 23e596abdb
Сommit 3fcd5ab840

@ -32,6 +32,10 @@
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
</Compiler> </Compiler>
<Unit filename="histogram.cpp" />
<Unit filename="histogram.h">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="main.cpp" /> <Unit filename="main.cpp" />
<Extensions> <Extensions>
<lib_finder disable_auto="1" /> <lib_finder disable_auto="1" />

@ -1,5 +1,5 @@
#include "histogram.h" #include "histogram.h"
using namespace std;
static void find_minmax(const vector<double>& numbers, double& min, double& max) static void find_minmax(const vector<double>& numbers, double& min, double& max)
{ {
min = numbers[0]; min = numbers[0];
@ -16,9 +16,7 @@ static void find_minmax(const vector<double>& numbers, double& min, double& max)
} }
} }
} }
vector<size_t> make_histogram(const vector<double>& numbers, size_t& bin_count)
vector<size_t>
make_histogram(const vector<double>& numbers, size_t& bin_count)
{ {
double min = 0; double min = 0;
double max = 0; double max = 0;

@ -1,8 +1,10 @@
#ifndef HISTOGRAM_H_INCLUDED #ifndef HISTOGRAM_H_INCLUDED
#define HISTOGRAM_H_INCLUDED #define HISTOGRAM_H_INCLUDED
#include <vector> #include <vector>
std::vector<size_t> std::vector<size_t>
make_histogram(const std::vector<double>& numbers, size_t bin_count); make_histogram(const std::vector<double>& numbers, size_t bin_count);
#endif // HISTOGRAM_H_INCLUDED #endif // HISTOGRAM_H_INCLUDED

@ -25,7 +25,6 @@ input_data() {
return in; return in;
} }
void void
show_histogram_text(const vector<size_t>& bins, size_t& bin_count) { show_histogram_text(const vector<size_t>& bins, size_t& bin_count) {
const size_t SCREEN_WIDTH = 80; const size_t SCREEN_WIDTH = 80;

Загрузка…
Отмена
Сохранить