MovsisianRG 12 месяцев назад
Родитель c9f0862835
Сommit 866f780a1f

@ -7,8 +7,8 @@
using namespace std; using namespace std;
const size_t SCREEN_WIDTH = 80; //const size_t SCREEN_WIDTH = 80;
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; //const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
struct Input struct Input
{ {
@ -18,46 +18,54 @@ struct Input
}; };
Input input_data() Input
input_data(istream& in)
{ {
size_t number_count, bin_count, IMAGE_WIDTH; size_t number_count, bin_count, IMAGE_WIDTH;
cerr << "Enter number count: "; cerr << "Enter number count: ";
cin >> number_count; in >> number_count;
Input in; Input n;
cerr << " Input width of image, > 70 but not >800 : ";
in >> n.IMAGE_WIDTH;
if(n.IMAGE_WIDTH < 70 || n.IMAGE_WIDTH > 800 ) {
while(n.IMAGE_WIDTH < 70 || n.IMAGE_WIDTH > 800) {
cerr << " Input width of image, >70 but not >800 : "; cerr << " Input width of image, >70 but not >800 : ";
cin >> in.IMAGE_WIDTH; in >> n.IMAGE_WIDTH;
}
}
//size_t number_count = in.number_counts;
in.numbers.resize(number_count); //size_t number_count = in.number_counts;
n.numbers.resize( number_count );
cerr << "Enter numbers: "; cerr << "Enter numbers: ";
// vector<double> numbers(number_count); // vector<double> numbers(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 >> n.numbers[i];
} }
cerr << "Count of baskets: "; cerr << "Count of baskets: ";
cin >> in.bin_count; in >> n.bin_count;
return in; return n;
} }
int main() int main()
{ {
auto in = input_data(); auto n = input_data(cin);
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram( n.numbers, n.bin_count );
//int chek_block_width(in.IMAGE_WIDTH); //int chek_block_width(in.IMAGE_WIDTH);
//chek_block_width(in.IMAGE_WIDTH, in.number_count); //chek_block_width(in.IMAGE_WIDTH, in.number_count);
//if (chek_block_width==1) //if (chek_block_width==1)
show_histogram_svg(bins,in.IMAGE_WIDTH); show_histogram_svg( bins,n.IMAGE_WIDTH );
//if(chek_block_width==0) return 0; //if(chek_block_width==0) return 0;
//show_histogram_svg(bins); //show_histogram_svg(bins);

Загрузка…
Отмена
Сохранить