Родитель
							
								
									cf4a8f505e
								
							
						
					
					
						Сommit
						c5c307ceeb
					
				@ -1,10 +1,4 @@
 | 
				
			|||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
struct Input {
 | 
					 | 
				
			||||||
    vector<double> vec;
 | 
					 | 
				
			||||||
    size_t korz{};
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
Input input_data();
 | 
					 | 
				
			||||||
void find_minmax(vector<double> vec, double& min, double& max);
 | 
					 | 
				
			||||||
vector<size_t> make_histogram(size_t number, vector<double> vec);
 | 
					vector<size_t> make_histogram(size_t number, vector<double> vec);
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#include "histogram_internal.h"
 | 
				
			||||||
 | 
					void find_minmax(vector<double> vec, double& min, double& max) {
 | 
				
			||||||
 | 
					    min = vec[0];
 | 
				
			||||||
 | 
					    max = vec[0];
 | 
				
			||||||
 | 
					    for (double x : vec) {
 | 
				
			||||||
 | 
					        if (x < min) {
 | 
				
			||||||
 | 
					            min = x;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (x > max)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            max = x;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					#include "Header.h"
 | 
				
			||||||
 | 
					void find_minmax(vector<double> vec, double& min, double& max);
 | 
				
			||||||
@ -1,8 +1,24 @@
 | 
				
			|||||||
#include "Header.h"
 | 
					#include "Header.h"
 | 
				
			||||||
#include "text.h"
 | 
					#include "text.h"
 | 
				
			||||||
 | 
					struct Input {
 | 
				
			||||||
 | 
					    vector<double> vec;
 | 
				
			||||||
 | 
					    size_t korz{};
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Input input_data() {
 | 
				
			||||||
 | 
					    Input in;
 | 
				
			||||||
 | 
					    size_t n, korz;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cerr << "Number of elem ";
 | 
				
			||||||
 | 
					    cin >> n;
 | 
				
			||||||
 | 
					    in.vec.resize(n);
 | 
				
			||||||
 | 
					    for (size_t i = 0; i < n; i++)
 | 
				
			||||||
 | 
					        cin >> in.vec[i];
 | 
				
			||||||
 | 
					    cerr << "Enter bin count: ";
 | 
				
			||||||
 | 
					    cin >> in.korz;
 | 
				
			||||||
 | 
					    return in;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
int main() {
 | 
					int main() {
 | 
				
			||||||
    auto in = input_data();
 | 
					    auto in = input_data();
 | 
				
			||||||
    auto bins = make_histogram(in.korz, in.vec);
 | 
					    auto bins = make_histogram(in.korz, in.vec);
 | 
				
			||||||
    show_histogram(bins);
 | 
					    show_histogram(bins);
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
					Загрузка…
					
					
				
		Ссылка в новой задаче