diff --git a/main.cpp b/main.cpp index a8af34a..2beee60 100644 --- a/main.cpp +++ b/main.cpp @@ -85,12 +85,32 @@ int main( int argc, char* argv[]){ 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'"; + cerr << "wrong type, choose format 'svg' or 'txt'" << endl; } }else{ - cerr << "type '-format' to choose output format"; + cerr << "type '-format' to choose output format" << endl; + } + }else{ + if ((format=argv[2])== "-format"){ + if ((type=argv[3])== "svg"){ + input = download(argv[3]); + const auto bins = make_histogram(input.numbers, input.bin_count); + show_histogram_svg(bins); + }else if ((type=argv[3])== "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'" << endl; + } + }else{ + cerr << "type '-format' to choose output format" << endl; } } + }else{ + input = input_data(cin, true); + const auto bins = make_histogram(input.numbers, input.bin_count); + show_histogram_svg(bins); } }