Сравнить коммиты
Ничего общего в коммитах. 'ee9b12fc4f6ea599b46b41fb430be4e98968515f' и 'bb51ae70ea3bfd8f4a672cf94c8b697595ede843' имеют совершенно разные истории.
ee9b12fc4f
...
bb51ae70ea
@ -1,45 +1,28 @@
|
|||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "svg.h"
|
#include "svg.h"
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
vector<double> vec;
|
vector<double> vec;
|
||||||
size_t korz{};
|
size_t korz{};
|
||||||
};
|
};
|
||||||
|
Input input_data() {
|
||||||
Input input_data(istream &in, bool prompt) {
|
Input in;
|
||||||
Input data;
|
|
||||||
size_t n, korz;
|
size_t n, korz;
|
||||||
|
|
||||||
if (prompt) {
|
|
||||||
cerr << "Number of elements: ";
|
cerr << "Number of elements: ";
|
||||||
}
|
cin >> n;
|
||||||
in >> n;
|
in.vec.resize(n);
|
||||||
data.vec.resize(n);
|
|
||||||
|
|
||||||
if (prompt) {
|
|
||||||
cerr << "Elements: ";
|
cerr << "Elements: ";
|
||||||
}
|
|
||||||
for (size_t i = 0; i < n; i++)
|
for (size_t i = 0; i < n; i++)
|
||||||
in >> data.vec[i];
|
cin >> in.vec[i];
|
||||||
|
|
||||||
if (prompt) {
|
|
||||||
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();
|
||||||
auto in_with_prompt = input_data(cin, true);
|
auto bins = make_histogram(in.korz, in.vec);
|
||||||
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
|
show_histogram_svg(bins);
|
||||||
show_histogram_svg(bins_with_prompt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче