|  |  |  | @ -4,17 +4,15 @@ | 
			
		
	
		
			
				
					|  |  |  |  | #include "svg.h" | 
			
		
	
		
			
				
					|  |  |  |  | #include "text.h" | 
			
		
	
		
			
				
					|  |  |  |  | #include <curl/curl.h> | 
			
		
	
		
			
				
					|  |  |  |  | #include <sstream> | 
			
		
	
		
			
				
					|  |  |  |  | #include <string> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 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{};
 | 
			
		
	
		
			
				
					|  |  |  |  | }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | Input input_data(istream &in, bool promt) | 
			
		
	
	
		
			
				
					|  |  |  | @ -28,21 +26,9 @@ Input input_data(istream &in, bool promt) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     Input input; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     // if (promt) cerr << " Input width of image, > 70 but not >800 : ";
 | 
			
		
	
		
			
				
					|  |  |  |  |     // in >> input.IMAGE_WIDTH;
 | 
			
		
	
		
			
				
					|  |  |  |  |     // if(input.IMAGE_WIDTH < 70 || input.IMAGE_WIDTH > 800 ) {
 | 
			
		
	
		
			
				
					|  |  |  |  |     // while(input.IMAGE_WIDTH < 70 || input.IMAGE_WIDTH > 800) {
 | 
			
		
	
		
			
				
					|  |  |  |  |     // if (promt) cerr << " Input width of image, >70 but not >800 : ";
 | 
			
		
	
		
			
				
					|  |  |  |  |     // in >> input.IMAGE_WIDTH;
 | 
			
		
	
		
			
				
					|  |  |  |  |     //}
 | 
			
		
	
		
			
				
					|  |  |  |  |     //}
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     // size_t number_count = in.number_counts;
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     input.numbers.resize(number_count); | 
			
		
	
		
			
				
					|  |  |  |  |     if (promt) | 
			
		
	
		
			
				
					|  |  |  |  |         cerr << "Enter numbers: "; | 
			
		
	
		
			
				
					|  |  |  |  |     // vector<double> numbers(number_count);
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     for (size_t i = 0; i < number_count; i++) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
	
		
			
				
					|  |  |  | @ -56,18 +42,19 @@ Input input_data(istream &in, bool promt) | 
			
		
	
		
			
				
					|  |  |  |  |     return input; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | int main(int argc, char *argv[]) | 
			
		
	
		
			
				
					|  |  |  |  | Input download(const string &address) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     stringstream buffer; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //address.c_str();
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     if (argc > 1) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |     curl_global_init(CURL_GLOBAL_ALL); | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |         CURL *curl = curl_easy_init(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (curl) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             CURLcode res; | 
			
		
	
		
			
				
					|  |  |  |  |                 curl_easy_setopt(curl, CURLOPT_URL, argv[1]); | 
			
		
	
		
			
				
					|  |  |  |  |             curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); | 
			
		
	
		
			
				
					|  |  |  |  |             res = curl_easy_perform(curl); | 
			
		
	
		
			
				
					|  |  |  |  |             CURL *curl = curl_easy_init(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (curl) | 
			
		
	
	
		
			
				
					|  |  |  | @ -86,15 +73,17 @@ int main(int argc, char *argv[]) | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return 0; | 
			
		
	
		
			
				
					|  |  |  |  |     return input_data(buffer, false); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | int | 
			
		
	
		
			
				
					|  |  |  |  | main(int argc, char* argv[]) { | 
			
		
	
		
			
				
					|  |  |  |  |     Input input; | 
			
		
	
		
			
				
					|  |  |  |  |     if (argc > 1) { | 
			
		
	
		
			
				
					|  |  |  |  |         input = download(argv[1]); | 
			
		
	
		
			
				
					|  |  |  |  |     } else { | 
			
		
	
		
			
				
					|  |  |  |  |         input = input_data(cin, true); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     auto input = input_data(cin, true); | 
			
		
	
		
			
				
					|  |  |  |  |     auto bins = make_histogram(input.numbers, input.bin_count); | 
			
		
	
		
			
				
					|  |  |  |  |     // int chek_block_width(in.IMAGE_WIDTH);
 | 
			
		
	
		
			
				
					|  |  |  |  |     // chek_block_width(in.IMAGE_WIDTH, in.number_count);
 | 
			
		
	
		
			
				
					|  |  |  |  |     // if (chek_block_width==1)
 | 
			
		
	
		
			
				
					|  |  |  |  |     const auto bins = make_histogram(input.numbers, input.bin_count); | 
			
		
	
		
			
				
					|  |  |  |  |     show_histogram_svg(bins); | 
			
		
	
		
			
				
					|  |  |  |  |     // if(chek_block_width==0) return 0;
 | 
			
		
	
		
			
				
					|  |  |  |  |     // show_histogram_svg(bins);
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |