|  |  |  | @ -20,7 +20,7 @@ size_t bin_count{}; | 
			
		
	
		
			
				
					|  |  |  |  | }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | Input | 
			
		
	
		
			
				
					|  |  |  |  | input_data(istream &tin, bool promt) | 
			
		
	
		
			
				
					|  |  |  |  | input_data(istream &sin, bool promt) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  | Input in; | 
			
		
	
		
			
				
					|  |  |  |  | size_t number_count; | 
			
		
	
	
		
			
				
					|  |  |  | @ -29,54 +29,66 @@ if (promt) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     cerr << "enter number count"; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | tin>> number_count; | 
			
		
	
		
			
				
					|  |  |  |  | sin>> number_count; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | in.numbers.resize(number_count); | 
			
		
	
		
			
				
					|  |  |  |  | for (size_t i = 0; i < number_count; i++) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  | in>> in.numbers[i]; | 
			
		
	
		
			
				
					|  |  |  |  | sin>> in.numbers[i]; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | if (promt) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     cerr<<"enter bin count:"; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | in >>in.bin_count; | 
			
		
	
		
			
				
					|  |  |  |  | sin >>in.bin_count; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | return in; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | size_t write_data(void* items, size_t item_size, size_t item_count, void* ctx) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     size_t data_size = item_size*item_count; | 
			
		
	
		
			
				
					|  |  |  |  |     stringstream* buffer = reinterpret_cast<stringstream*>(ctx); | 
			
		
	
		
			
				
					|  |  |  |  |     buffer->write(reinterpret_cast<const char*>(items), data_size); | 
			
		
	
		
			
				
					|  |  |  |  |     return data_size; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | int main(int arg, char* argv[]) | 
			
		
	
		
			
				
					|  |  |  |  | Input | 
			
		
	
		
			
				
					|  |  |  |  | download(const string& adress) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     if (arg > 1) | 
			
		
	
		
			
				
					|  |  |  |  |     stringstream buffer; | 
			
		
	
		
			
				
					|  |  |  |  |     CURL* curl = curl_easy_init(); | 
			
		
	
		
			
				
					|  |  |  |  |     if(curl) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |         CURL* curl = curl_easy_init(); | 
			
		
	
		
			
				
					|  |  |  |  |         if(curl) | 
			
		
	
		
			
				
					|  |  |  |  |         CURLcode res; | 
			
		
	
		
			
				
					|  |  |  |  |         curl_easy_setopt(curl, CORLOPT_URL, adress); | 
			
		
	
		
			
				
					|  |  |  |  |         curl_easy_setopt(curl, CURLOPT_WRITEDATA,&buffer); | 
			
		
	
		
			
				
					|  |  |  |  |         res=curl_easy_perform(curl); | 
			
		
	
		
			
				
					|  |  |  |  |         curl_easy_cleanup(curl); | 
			
		
	
		
			
				
					|  |  |  |  |         if(res!=CURLE_OK) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             CURLcode res; | 
			
		
	
		
			
				
					|  |  |  |  |             curl_easy_setopt(curl,CURLOPT_URL,argv[1]); | 
			
		
	
		
			
				
					|  |  |  |  |             res = curl_easy_perform(curl); | 
			
		
	
		
			
				
					|  |  |  |  |             curl_easy_cleanup(curl); | 
			
		
	
		
			
				
					|  |  |  |  |             if (res != CURE_OK) | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 cout<<curl_easy_strerror; | 
			
		
	
		
			
				
					|  |  |  |  |                 exit(1); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             cout<<curl_easy_strerror; | 
			
		
	
		
			
				
					|  |  |  |  |             exit(1); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return 0; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); | 
			
		
	
		
			
				
					|  |  |  |  |     return input_data(buffer, false); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | Input in = input_data(); | 
			
		
	
		
			
				
					|  |  |  |  | char arr[bin_count]; | 
			
		
	
		
			
				
					|  |  |  |  | for(int i=0; i<bin_count;i++) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | int main(int arg, char* argv[]) | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  |     cin>>arr[i]; | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  |     if (arg > 1) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |     input = download(argv[1]); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |     else | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |         input=input_data(cin,true); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | auto bins = make_histogram(in.numbers, in.bin_count); | 
			
		
	
		
			
				
					|  |  |  |  | show_histogram_svg(bins); | 
			
		
	
		
			
				
					|  |  |  |  | return 0; | 
			
		
	
	
		
			
				
					|  |  |  | 
 |