code: Заменен вывод на cerr, а также добавлен вывод гистограммы в виде SVG
Этот коммит содержится в:
@@ -1,7 +1,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
|
#include "svg.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -13,26 +15,30 @@ struct Input {
|
|||||||
|
|
||||||
Input input_data() {
|
Input input_data() {
|
||||||
size_t number_count;
|
size_t number_count;
|
||||||
cout << "Enter number count: ";
|
cerr << "Enter number count: ";
|
||||||
cin >> number_count;
|
cin >> number_count;
|
||||||
|
|
||||||
Input in;
|
Input in;
|
||||||
in.numbers.resize(number_count);
|
in.numbers.resize(number_count);
|
||||||
cout << "Enter " << number_count << " numbers: ";
|
cerr << "Enter " << number_count << " numbers: ";
|
||||||
for (size_t i = 0; i < number_count; i++) {
|
for (size_t i = 0; i < number_count; i++) {
|
||||||
cin >> in.numbers[i];
|
cin >> in.numbers[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Enter bin count: ";
|
cerr << "Enter bin count: ";
|
||||||
cin >> in.bin_count;
|
cin >> in.bin_count;
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
auto in = input_data();
|
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_text(bins);
|
show_histogram_text(bins);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Ссылка в новой задаче
Block a user