|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "text.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
@ -11,29 +11,34 @@ struct Input {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
|
input_data() {
|
|
|
|
|
input_data(istream& _cin){
|
|
|
|
|
bool prompt = true;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cout << "Enter number count: ";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
if (prompt){
|
|
|
|
|
cerr << "Enter number count:" << endl;
|
|
|
|
|
}
|
|
|
|
|
_cin >> number_count;
|
|
|
|
|
Input in;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
vector<double> numbers(number_count);
|
|
|
|
|
for (size_t i = 0; i < number_count; i++)
|
|
|
|
|
{
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
if (prompt){
|
|
|
|
|
cerr << "Enter numbers:" << endl;
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
_cin >> in.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
if (prompt){
|
|
|
|
|
cerr << "Enter bin count:" << endl;
|
|
|
|
|
}
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
cout << "Enter count bin : ";
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
_cin >> in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
const size_t SCREEN_WIDTH = 80;
|
|
|
|
|
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
const std::vector<double> bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
int
|
|
|
|
|
main() {
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|