Родитель
bb51ae70ea
Сommit
30304c0921
@ -1,28 +1,32 @@
|
|||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "svg.h"
|
#include "svg.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
vector<double> vec;
|
std::vector<double> vec;
|
||||||
size_t korz{};
|
size_t korz{};
|
||||||
};
|
};
|
||||||
Input input_data() {
|
|
||||||
Input in;
|
Input input_data(std::istream &in) {
|
||||||
|
Input data;
|
||||||
size_t n, korz;
|
size_t n, korz;
|
||||||
|
|
||||||
cerr << "Number of elements: ";
|
cerr << "Number of elements: ";
|
||||||
cin >> n;
|
in >> n;
|
||||||
in.vec.resize(n);
|
data.vec.resize(n);
|
||||||
cerr << "Elements: ";
|
cerr << "Elements: ";
|
||||||
for (size_t i = 0; i < n; i++)
|
for (size_t i = 0; i < n; i++)
|
||||||
cin >> in.vec[i];
|
in >> data.vec[i];
|
||||||
cerr << "Enter bin count: ";
|
cerr << "Enter bin count: ";
|
||||||
cin >> in.korz;
|
in >> korz;
|
||||||
return in;
|
data.korz = korz;
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
auto in = input_data();
|
using namespace std;
|
||||||
|
auto in = input_data(cin);
|
||||||
auto bins = make_histogram(in.korz, in.vec);
|
auto bins = make_histogram(in.korz, in.vec);
|
||||||
show_histogram_svg(bins);
|
show_histogram_svg(bins);
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче