Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

71 строка
1.5 KiB
C++

#include <iostream>
#include <vector>
#include "histogram.h"
#include "svg.h"
#include "text.h"
//#include "mycheck.h"
using namespace std;
//const size_t SCREEN_WIDTH = 80;
//const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
struct Input
{
vector<double> numbers;
size_t bin_count{};
size_t IMAGE_WIDTH{};
bool valid;
};
Input input_data()
{
size_t number_count, bin_count, IMAGE_WIDTH;
cerr << "Enter number count: ";
cin >> number_count;
Input in;
cerr << " Input width of image, > 70 but not >800 : ";
cin >> in.IMAGE_WIDTH;
if(in.IMAGE_WIDTH < 70 || in.IMAGE_WIDTH > 800 ) {
while(in.IMAGE_WIDTH < 70 || in.IMAGE_WIDTH > 800) {
cerr << " Input width of image, >70 but not >800 : ";
cin >> in.IMAGE_WIDTH;
}
}
//size_t number_count = in.number_counts;
in.numbers.resize( number_count );
cerr << "Enter numbers: ";
// vector<double> numbers(number_count);
for (size_t i = 0; i < number_count; i++)
{
cin >> in.numbers[i];
}
cerr << "Count of baskets: ";
cin >> in.bin_count;
return in;
}
int main()
{
auto in = input_data();
auto bins = make_histogram( in.numbers, in.bin_count );
//int chek_block_width(in.IMAGE_WIDTH);
//chek_block_width(in.IMAGE_WIDTH, in.number_count);
//if (chek_block_width==1)
show_histogram_svg( bins,in.IMAGE_WIDTH );
//if(chek_block_width==0) return 0;
//show_histogram_svg(bins);
}