Сравнить коммиты
5 Коммитов
6d92425a8c
...
112373a5bd
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
112373a5bd | ||
|
|
3818146131 | ||
|
|
d25177cf18 | ||
|
|
468675743d | ||
|
|
cd14de2329 |
1
.gitignore
поставляемый
1
.gitignore
поставляемый
@@ -1,6 +1,7 @@
|
|||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
||||||
|
/curl
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
*.lo
|
*.lo
|
||||||
|
|||||||
15
lab34.cbp
15
lab34.cbp
@@ -13,7 +13,13 @@
|
|||||||
<Option compiler="gcc" />
|
<Option compiler="gcc" />
|
||||||
<Compiler>
|
<Compiler>
|
||||||
<Add option="-g" />
|
<Add option="-g" />
|
||||||
|
<Add directory="curl/include" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
|
<Linker>
|
||||||
|
<Add option="-static" />
|
||||||
|
<Add library="curl/lib/libcurl.dll.a" />
|
||||||
|
<Add directory="curl/lib" />
|
||||||
|
</Linker>
|
||||||
</Target>
|
</Target>
|
||||||
<Target title="Release">
|
<Target title="Release">
|
||||||
<Option output="bin/Release/lab34" prefix_auto="1" extension_auto="1" />
|
<Option output="bin/Release/lab34" prefix_auto="1" extension_auto="1" />
|
||||||
@@ -32,7 +38,16 @@
|
|||||||
<Add option="-Wall" />
|
<Add option="-Wall" />
|
||||||
<Add option="-fexceptions" />
|
<Add option="-fexceptions" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
|
<Unit filename=".gitignore" />
|
||||||
|
<Unit filename="README.md" />
|
||||||
|
<Unit filename="histogram.cpp" />
|
||||||
|
<Unit filename="histogram.h" />
|
||||||
|
<Unit filename="lab34.cbp" />
|
||||||
|
<Unit filename="lab34.depend" />
|
||||||
<Unit filename="main.cpp" />
|
<Unit filename="main.cpp" />
|
||||||
|
<Unit filename="svg.cpp" />
|
||||||
|
<Unit filename="svg.h" />
|
||||||
|
<Unit filename="text.h" />
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<lib_finder disable_auto="1" />
|
<lib_finder disable_auto="1" />
|
||||||
</Extensions>
|
</Extensions>
|
||||||
|
|||||||
77
lab34.depend
77
lab34.depend
@@ -19,3 +19,80 @@
|
|||||||
<vector>
|
<vector>
|
||||||
<string>
|
<string>
|
||||||
|
|
||||||
|
1684755117 source:c:\users\stepa\desktop\lab04\lab04\histogram.cpp
|
||||||
|
"histogram.h"
|
||||||
|
"vector"
|
||||||
|
|
||||||
|
1684755161 c:\users\stepa\desktop\lab04\lab04\histogram.h
|
||||||
|
<vector>
|
||||||
|
<vector>
|
||||||
|
<cstddef>
|
||||||
|
|
||||||
|
1684755057 source:c:\users\stepa\desktop\lab04\lab04\svg.cpp
|
||||||
|
"svg.h"
|
||||||
|
<iostream>
|
||||||
|
<string>
|
||||||
|
<vector>
|
||||||
|
"cmath"
|
||||||
|
|
||||||
|
1684757154 c:\users\stepa\desktop\lab04\lab04\svg.h
|
||||||
|
<vector>
|
||||||
|
<string>
|
||||||
|
|
||||||
|
1685953545 source:c:\users\stepa\desktop\lab04\lab04\main.cpp
|
||||||
|
<iostream>
|
||||||
|
"vector"
|
||||||
|
"svg.h"
|
||||||
|
"histogram.h"
|
||||||
|
"curl/curl.h"
|
||||||
|
<sstream>
|
||||||
|
<string>
|
||||||
|
|
||||||
|
1685361112 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\curl.h
|
||||||
|
"curlver.h"
|
||||||
|
"system.h"
|
||||||
|
<stdio.h>
|
||||||
|
<limits.h>
|
||||||
|
<osreldate.h>
|
||||||
|
<sys/types.h>
|
||||||
|
<time.h>
|
||||||
|
<winsock2.h>
|
||||||
|
<ws2tcpip.h>
|
||||||
|
<sys/select.h>
|
||||||
|
<sys/socket.h>
|
||||||
|
<sys/time.h>
|
||||||
|
"easy.h"
|
||||||
|
"multi.h"
|
||||||
|
"urlapi.h"
|
||||||
|
"options.h"
|
||||||
|
"header.h"
|
||||||
|
"websockets.h"
|
||||||
|
"typecheck-gcc.h"
|
||||||
|
|
||||||
|
1685416610 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\curlver.h
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\system.h
|
||||||
|
<ConditionalMacros.h>
|
||||||
|
<winsock2.h>
|
||||||
|
<windows.h>
|
||||||
|
<ws2tcpip.h>
|
||||||
|
<sys/types.h>
|
||||||
|
<sys/socket.h>
|
||||||
|
<sys/poll.h>
|
||||||
|
|
||||||
|
1685004688 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\easy.h
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\multi.h
|
||||||
|
"curl.h"
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\urlapi.h
|
||||||
|
"curl.h"
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\options.h
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\header.h
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\websockets.h
|
||||||
|
|
||||||
|
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\typecheck-gcc.h
|
||||||
|
|
||||||
|
|||||||
20
lab34.layout
Обычный файл
20
lab34.layout
Обычный файл
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_layout_file>
|
||||||
|
<FileVersion major="1" minor="0" />
|
||||||
|
<ActiveTarget name="Debug" />
|
||||||
|
<File name=".gitignore" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="29" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="histogram.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="0" topLine="3" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="1800" topLine="59" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
</CodeBlocks_layout_file>
|
||||||
127
main.cpp
127
main.cpp
@@ -1,39 +1,120 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "vector"
|
#include <vector>
|
||||||
#include "svg.h"
|
#include <conio.h>
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
//#include "curl/curl.h"
|
#include "text.h"
|
||||||
|
#include "svg.h"
|
||||||
|
#include <curl/curl.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
struct Input
|
||||||
|
{
|
||||||
|
|
||||||
struct Input {
|
|
||||||
vector<double> numbers;
|
vector<double> numbers;
|
||||||
size_t bin_count{};
|
size_t bin_count{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Input
|
||||||
|
input_data(istream& in, bool promt)
|
||||||
|
{
|
||||||
|
size_t number_count;
|
||||||
|
if (promt)
|
||||||
|
{
|
||||||
|
cerr << "Enter number count: ";
|
||||||
|
}
|
||||||
|
in >> number_count;
|
||||||
|
|
||||||
|
Input ik;
|
||||||
|
ik.numbers.resize(number_count);
|
||||||
|
for (size_t i = 0; i < number_count; i++)
|
||||||
|
{
|
||||||
|
in >> ik.numbers[i];
|
||||||
|
}
|
||||||
|
if (promt)
|
||||||
|
{
|
||||||
|
cerr << "Enter bin count: ";
|
||||||
|
}
|
||||||
|
in>> ik.bin_count;
|
||||||
|
return ik;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Input
|
Input
|
||||||
input_data(istream& inn, bool promt) {
|
download(const string& address)
|
||||||
size_t number_count;
|
{
|
||||||
cin >> number_count;
|
stringstream buffer;
|
||||||
Input in;
|
CURL *curl = curl_easy_init();
|
||||||
in.numbers.resize(number_count);
|
if(curl)
|
||||||
|
{
|
||||||
|
CURLcode res;
|
||||||
|
double file_size;
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||||
|
res = curl_easy_perform(curl);
|
||||||
|
if (res != CURLE_OK)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
|
||||||
for (size_t i = 0; i < number_count; i++) {
|
}
|
||||||
cin >> in.numbers[i];
|
return input_data(buffer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
cin >> in.bin_count;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char* argv[])
|
||||||
// curl_global_init(CURL_GLOBAL_ALL);
|
{
|
||||||
auto in = input_data(cin, true);
|
Input input;
|
||||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
if (argc > 1)
|
||||||
show_histogram_text(bins, in.bin_count);
|
{
|
||||||
//show_histogram_svg(bins);
|
input = download(argv[3]);
|
||||||
|
int bins_cnt = atoi(argv[2]);
|
||||||
|
string check = typeid(atoi(argv[2])).name();
|
||||||
|
if(check != "int"){
|
||||||
|
cout << "Ââåäèòå ÷èñëî ïîñëå -bins";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
const auto bins = make_histogram(input.numbers, bins_cnt);
|
||||||
|
show_histogram_svg(bins);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input = input_data(cin, true);
|
||||||
|
const auto bins = make_histogram(input.numbers, input.bin_count);
|
||||||
|
show_histogram_svg(bins);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//const auto bins = make_histogram(input.numbers, input.bin_count);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
Input input;
|
||||||
|
if (argc > 1)
|
||||||
|
{
|
||||||
|
int bins_cnt = atoi(argv[2]);
|
||||||
|
input = download(argv[3]);
|
||||||
|
const auto bins = make_histogram(input.numbers, bins_cnt);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input = input_data(cin, true);
|
||||||
|
const auto bins = make_histogram(input.numbers, input.bin_count);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user