Сравнить коммиты

..

2 Коммитов

Автор SHA1 Сообщение Дата
victoriaCS
85277aaf0c code: добавление prompt 2025-09-17 22:22:49 +03:00
victoriaCS
689ac0417f code: изменение input_data() 2025-09-17 22:15:28 +03:00

Просмотреть файл

@@ -1,38 +1,40 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h" #include "svg.h"
//#include "doctest.h" #include "hictogram.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_steam = cin) { Input input_data(istream& in, bool prompt) {
cerr << "Enter number count: "; size_t number_count;
cin >> number_count; if (prompt){
cerr << "Enter number count: "
}
in >> number_count;
Input in; Input in_data;
in.numbers.resize(number_count); in_data.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++) { for (size_t i = 0; i < number_count; i++) {
cin >> in.numbers[i]; in >> in_data.numbers[i];
} }
cerr << "Enter bin count: ";
cin >> in.bin_count;
return in; if (prompt){
cer << "Enter bin count: "
}
in >> in_data.bin_count;
return in_data;
} }
int main() { int main() {
auto in = input_data(); auto in = input_data(cin, true);
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins, in.block_width); show_histogram_svg(bins);
} }