cs-lab4/main.cpp

50 строки
803 B
C++

#include <iostream>
#include <cmath>
#include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h"
using namespace std;
struct Input
{
vector<double> numbers;
size_t bin_count{};
};
Input
input_data(istream& in, bool prompt)
{
if(prompt)
cerr << "count=";
size_t number_count;
in >> number_count;
Input rez;
if(prompt)
cerr << "bin_count= ";
rez.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++)
{
in >> rez.numbers[i];
}
if(prompt)
cerr << "bin_count= ";
in >> rez.bin_count;
return rez;
}
int main()
{
bool prompt = true;
auto in = input_data(cin, prompt);
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins);
return 0;
}