code: Конечный код
Этот коммит содержится в:
17
main.cpp
17
main.cpp
@@ -21,17 +21,18 @@ Input
|
|||||||
input_data(istream& stream, bool prompt)
|
input_data(istream& stream, bool prompt)
|
||||||
{
|
{
|
||||||
size_t number_count;
|
size_t number_count;
|
||||||
if (prompt)
|
if (prompt==true)
|
||||||
{
|
{
|
||||||
cerr << "Enter number count: ";
|
cerr << "Enter number count: ";
|
||||||
}
|
}
|
||||||
stream >> number_count;
|
stream >> number_count;
|
||||||
Input in;
|
Input in;
|
||||||
if (prompt)
|
if (prompt==true)
|
||||||
{
|
{
|
||||||
cerr << "Enter bin count: ";
|
cerr << "Enter bin count: ";
|
||||||
}
|
}
|
||||||
stream >> in.bin_count;
|
stream >> in.bin_count;
|
||||||
|
|
||||||
vector<double> numbers(in.number_count);
|
vector<double> numbers(in.number_count);
|
||||||
in.numbers.resize(in.number_count);
|
in.numbers.resize(in.number_count);
|
||||||
for (size_t i = 0; i < in.number_count; i++)
|
for (size_t i = 0; i < in.number_count; i++)
|
||||||
@@ -64,15 +65,21 @@ Input download(const string& address)
|
|||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if (res != CURLE_OK)
|
curl_easy_cleanup(curl);
|
||||||
|
if (res != 0)
|
||||||
{
|
{
|
||||||
curl_easy_strerror(res);
|
cout << res;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
curl_easy_cleanup(curl);
|
curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
|
||||||
|
for (size_t i = 0; curl_info->protocols != NULL; i++){
|
||||||
|
cerr << curl_info->protocols[i] << "\n";
|
||||||
}
|
}
|
||||||
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
return input_data(buffer, false);
|
return input_data(buffer, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]){
|
int main(int argc, char* argv[]){
|
||||||
|
|
||||||
Input in;
|
Input in;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user