Сравнить коммиты
1 Коммитов
master
...
b7e2e9af42
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
b7e2e9af42 |
36
main.cpp
36
main.cpp
@@ -1,40 +1,38 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "histogram.h"
|
||||||
|
#include "text.h"
|
||||||
#include "svg.h"
|
#include "svg.h"
|
||||||
#include "hictogram.h"
|
//#include "doctest.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
vector<double> numbers;
|
vector<double> numbers;
|
||||||
size_t bin_count{};
|
size_t bin_count{};
|
||||||
|
size_t block_width{};
|
||||||
};
|
};
|
||||||
|
|
||||||
Input input_data(istream& in, bool prompt) {
|
Input input_data(istream& in_steam = cin) {
|
||||||
size_t number_count;
|
cerr << "Enter number count: ";
|
||||||
if (prompt){
|
cin >> number_count;
|
||||||
cerr << "Enter number count: "
|
|
||||||
}
|
|
||||||
in >> number_count;
|
|
||||||
|
|
||||||
Input in_data;
|
Input in;
|
||||||
in_data.numbers.resize(number_count);
|
in.numbers.resize(number_count);
|
||||||
|
|
||||||
for (size_t i = 0; i < number_count; i++) {
|
for (size_t i = 0; i < number_count; i++) {
|
||||||
in >> in_data.numbers[i];
|
cin >> in.numbers[i];
|
||||||
}
|
}
|
||||||
|
cerr << "Enter bin count: ";
|
||||||
|
cin >> in.bin_count;
|
||||||
|
|
||||||
if (prompt){
|
return in;
|
||||||
cer << "Enter bin count: "
|
|
||||||
}
|
|
||||||
in >> in_data.bin_count;
|
|
||||||
|
|
||||||
return in_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
auto in = input_data(cin, true);
|
auto in = input_data();
|
||||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||||
show_histogram_svg(bins);
|
show_histogram_svg(bins, in.block_width);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user