|
|
|
@ -73,14 +73,24 @@ Input download(const string& address) {
|
|
|
|
|
int main( int argc, char* argv[]){
|
|
|
|
|
Input input;
|
|
|
|
|
if (argc > 1){
|
|
|
|
|
input = download(argv[1]);
|
|
|
|
|
}else{
|
|
|
|
|
input = input_data(cin, true);
|
|
|
|
|
string adr, format, type;
|
|
|
|
|
if ((adr=argv[1]).substr(0,7)!= "http://"){
|
|
|
|
|
if ((format=argv[1])== "-format"){
|
|
|
|
|
if ((type=argv[2])== "svg"){
|
|
|
|
|
input = download(argv[3]);
|
|
|
|
|
const auto bins = make_histogram(input.numbers, input.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
}else if ((type=argv[2])== "text"){
|
|
|
|
|
input = download(argv[3]);
|
|
|
|
|
auto bins = make_histogram(input.numbers, input.bin_count);
|
|
|
|
|
show_histogram_text(bins, input.bin_count);
|
|
|
|
|
}else{
|
|
|
|
|
cerr << "wrong type, choose format 'svg' or 'txt'";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
cerr << "type '-format' to choose output format";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto bins = make_histogram(input);
|
|
|
|
|
|
|
|
|
|
show_histogram_text(bins, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|