Oleg 2 лет назад
Родитель 21a6cf40ce
Сommit beb0d24a79

@ -3,12 +3,13 @@
<iostream> <iostream>
<vector> <vector>
1694257548 source:c:\users\texas\desktop\lab01\main.cpp 1696098686 source:c:\users\texas\desktop\lab01\main.cpp
<math.h> <math.h>
<vector> <vector>
<iostream> <iostream>
<string.h> <sstream>
<curl/curl.h> <curl/curl.h>
<string>
"histogram.h" "histogram.h"
"text.h" "text.h"
"svg.h" "svg.h"

@ -2,44 +2,44 @@
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<FileVersion major="1" minor="0" /> <FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" /> <ActiveTarget name="Debug" />
<File name=".gitignore" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="15" zoom_2="0"> <File name="text.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="11" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="19" topLine="0" /> <Cursor1 position="448" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="main.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="15" zoom_2="0"> <File name="text.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="13" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="867" topLine="18" /> <Cursor1 position="69" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="svg.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="17" zoom_2="0"> <File name="histogram.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="17" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="18" topLine="0" /> <Cursor1 position="523" topLine="15" />
</Cursor> </Cursor>
</File> </File>
<File name="histogram.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="16" zoom_2="0"> <File name="svg.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="20" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="175" topLine="0" /> <Cursor1 position="168" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="histogram.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="17" zoom_2="0"> <File name="main.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="15" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="566" topLine="0" /> <Cursor1 position="1289" topLine="41" />
</Cursor> </Cursor>
</File> </File>
<File name="text.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="11" zoom_2="0"> <File name="svg.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="17" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="448" topLine="0" /> <Cursor1 position="18" topLine="34" />
</Cursor> </Cursor>
</File> </File>
<File name="svg.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="20" zoom_2="0"> <File name=".gitignore" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="15" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="168" topLine="0" /> <Cursor1 position="19" topLine="0" />
</Cursor> </Cursor>
</File> </File>
<File name="text.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="13" zoom_2="0"> <File name="histogram.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="16" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="69" topLine="0" /> <Cursor1 position="175" topLine="0" />
</Cursor> </Cursor>
</File> </File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

@ -2,9 +2,9 @@
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string.h>
#include <curl/curl.h> #include <curl/curl.h>
#include <string> #include <string>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg.h" #include "svg.h"
@ -63,12 +63,13 @@ download(const string& address) {
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
if(curl) { if(curl) {
CURLcode res; CURLcode res;
res = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
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);
if(res != CURLE_OK){ if(res != CURLE_OK){
cerr << curl_easy_strerror(res); cerr << curl_easy_strerror(res);
exit(1);} exit(1);}
@ -84,7 +85,7 @@ int main(int argc, char* argv[]){
else { else {
input = input_data(cin, true);} input = input_data(cin, true);}
const auto bins = make_histogram(input.numbers, input.bin_count); const auto bins = make_histogram(input);
show_histogram_svg(bins); show_histogram_svg(bins);
return 0; return 0;
} }

Загрузка…
Отмена
Сохранить