|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
@ -7,7 +9,7 @@ using namespace std;
|
|
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
|
vector <double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
size_t bin_count{}, number_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data(){
|
|
|
|
@ -25,30 +27,14 @@ Input input_data() {
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Input in = input_data();
|
|
|
|
|
double min, max;
|
|
|
|
|
find_minmax(in.numbers, min, max);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void find_minmax(vector<double>& numbers, double& min, double& max) {
|
|
|
|
|
auto counts=numbers.size();
|
|
|
|
|
int i;
|
|
|
|
|
min = number[0];
|
|
|
|
|
max = number[0];
|
|
|
|
|
for (i=0; i<counts;i++) {
|
|
|
|
|
if (number[i]< minn) {
|
|
|
|
|
min = number[i];
|
|
|
|
|
}
|
|
|
|
|
else if (number[i]> maxx) {
|
|
|
|
|
max = number[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|