code: добавил гистограмму
Этот коммит содержится в:
@@ -32,10 +32,18 @@
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
</Compiler>
|
||||
<Unit filename=",r,t,t,,t r.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename=".gitignore" />
|
||||
<Unit filename="111.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="histogram.cpp" />
|
||||
<Unit filename="histogram.h" />
|
||||
<Unit filename="main.cpp" />
|
||||
<Unit filename="text.cpp" />
|
||||
<Unit filename="text.h" />
|
||||
<Extensions>
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
|
||||
32
main.cpp
32
main.cpp
@@ -1,16 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <math.h>
|
||||
#include "histogram.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
struct Input {
|
||||
vector<double> numbers;
|
||||
size_t bin_count{};
|
||||
vector <double> numbers;
|
||||
size_t bin_count{}, number_count{};
|
||||
};
|
||||
|
||||
Input input_data() {
|
||||
Input input_data(){
|
||||
size_t number_count, bin_count;
|
||||
cin >> number_count;
|
||||
Input in;
|
||||
@@ -25,9 +27,10 @@ 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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,20 +38,3 @@ int main()
|
||||
|
||||
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user