code: добавил гистограмму

main
Senya (YershovArA) 2 лет назад
Родитель 6120a2a2c2
Сommit 279ed6d725

@ -32,10 +32,18 @@
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
</Compiler> </Compiler>
<Unit filename=",r,t,t,,t r.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename=".gitignore" />
<Unit filename="111.c"> <Unit filename="111.c">
<Option compilerVar="CC" /> <Option compilerVar="CC" />
</Unit> </Unit>
<Unit filename="histogram.cpp" />
<Unit filename="histogram.h" />
<Unit filename="main.cpp" /> <Unit filename="main.cpp" />
<Unit filename="text.cpp" />
<Unit filename="text.h" />
<Extensions> <Extensions>
<lib_finder disable_auto="1" /> <lib_finder disable_auto="1" />
</Extensions> </Extensions>

@ -1,5 +1,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <math.h>
#include "histogram.h"
using namespace std; using namespace std;
@ -7,7 +9,7 @@ using namespace std;
struct Input { struct Input {
vector <double> numbers; vector <double> numbers;
size_t bin_count{}; size_t bin_count{}, number_count{};
}; };
Input input_data(){ Input input_data(){
@ -25,30 +27,14 @@ Input input_data() {
int main() int main()
{ {
Input in = input_data(); auto in = input_data();
double min, max;
find_minmax(in.numbers, min, max);
}
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];
}
}
}

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