#include "histogram.h" #include using namespace std; void find_minmax(const vector& numbers, double& min, double& max) { min = numbers[0]; max = numbers[0]; for ( size_t i=0; i < numbers.size(); i++) { if (numbers[i] > max) max=numbers[i]; if (numbers[i] < min) min=numbers[i]; } }; std::vector make_histogram(const vector& numbers,size_t bin_count) { float lo,hi,dif; double min, max; find_minmax(numbers, min, max); vector bins(bin_count) ; dif=(max - min)/bin_count; for(int i=0; i < numbers.size(); i++) { bool found = false; for (int j=0; (j < bin_count-1)&&!found; j++) { lo= min + j*dif; hi= min + (j+1)*dif; if ((lo <= numbers[i]) && (numbers[i]