Сравнить коммиты

..

6 Коммитов

4 изменённых файлов: 126 добавлений и 27 удалений

2
.gitignore поставляемый
Просмотреть файл

@@ -1,3 +1,5 @@
/bin /bin
/obj /obj
/lab1.layout /lab1.layout
/curl
/lab1.depend

Просмотреть файл

@@ -31,7 +31,12 @@
<Compiler> <Compiler>
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
<Add directory="C:/Users/Professional/Desktop/cs-lab34/lab1/curl/include" />
</Compiler> </Compiler>
<Linker>
<Add library="C:/Users/Professional/Desktop/cs-lab34/lab1/curl/lib/libcurl.dll.a" />
<Add directory="C:/Users/Professional/Desktop/cs-lab34/lab1/curl/lib" />
</Linker>
<Unit filename="histogram.cpp" /> <Unit filename="histogram.cpp" />
<Unit filename="histogram.h"> <Unit filename="histogram.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />

Просмотреть файл

@@ -1,33 +1,85 @@
# depslib dependency file v1.0 # depslib dependency file v1.0
1747403061 source:c:\users\professional\desktop\cs-lab34\lab1\histogram.cpp 1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\histogram.cpp
"histogram.h" "histogram.h"
1747403061 c:\users\professional\desktop\cs-lab34\lab1\histogram.h 1747403716 c:\users\professional\desktop\cs-lab34\lab1\histogram.h
<vector> <vector>
<iostream> <iostream>
1746444035 source:c:\users\professional\desktop\cs-lab34\lab1\text.cpp 1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\text.cpp
"text.h" "text.h"
"histogram.h"
<iostream>
<vector>
<string>
1747403061 c:\users\professional\desktop\cs-lab34\lab1\text.h 1747403716 c:\users\professional\desktop\cs-lab34\lab1\text.h
<iostream> <iostream>
<vector> <vector>
1747403061 source:c:\users\professional\desktop\cs-lab34\lab1\main.cpp 1747651892 source:c:\users\professional\desktop\cs-lab34\lab1\main.cpp
<curl/curl.h>
"histogram.h" "histogram.h"
"text.h" "text.h"
"svg.h" "svg.h"
<iostream>
<vector>
1747403061 c:\users\professional\desktop\cs-lab34\lab1\svg.h 1747403716 c:\users\professional\desktop\cs-lab34\lab1\svg.h
<iostream> <iostream>
<vector> <vector>
<string> <string>
<math.h> <math.h>
1747403061 source:c:\users\professional\desktop\cs-lab34\lab1\svg.cpp 1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\svg.cpp
"svg.h" "svg.h"
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\curl.h
"curlver.h"
"system.h"
<stdio.h>
<limits.h>
<sys/param.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"
"mprintf.h"
"typecheck-gcc.h"
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\curlver.h
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\system.h
<ConditionalMacros.h>
<inttypes.h>
<inttypes.h>
<sys/types.h>
<sys/socket.h>
<sys/poll.h>
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\easy.h
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\multi.h
"curl.h"
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\urlapi.h
"curl.h"
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\options.h
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\header.h
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\websockets.h
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\mprintf.h
<stdarg.h>
<stdio.h>
"curl.h"
1743562062 c:\users\professional\desktop\cs-lab34\lab1\curl\include\curl\typecheck-gcc.h

Просмотреть файл

@@ -1,28 +1,68 @@
#include <iostream>
#include <curl/curl.h>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg.h" #include "svg.h"
#include <vector>
using namespace std;
struct Input { struct Input {
vector<double> vec; vector<double> vec;
size_t korz{}; size_t korz{};
}; };
Input input_data() {
Input in; Input input_data(istream &in, bool prompt) {
Input data;
size_t n, korz; size_t n, korz;
cerr << "Number of elements: "; if (prompt) {
cin >> n; cerr << "Number of elements: ";
in.vec.resize(n); }
cerr << "Elements: "; in >> n;
for (size_t i = 0; i < n; i++) data.vec.resize(n);
cin >> in.vec[i];
cerr << "Enter bin count: "; if (prompt) {
cin >> in.korz; cerr << "Elements: ";
return in; }
for (size_t i = 0; i < n; i++) {
in >> data.vec[i];
}
if (prompt) {
cerr << "Enter bin count: ";
}
in >> korz;
data.korz = korz;
return data;
} }
int main() { int main(int argc, char* argv[]) {
auto in = input_data(); curl_global_init(CURL_GLOBAL_ALL);
auto bins = make_histogram(in.korz, in.vec);
show_histogram_svg(bins); if (argc > 1) {
const char *url = argv[1];
CURL *curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, url);
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) {
cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << endl;
exit(1);
}
curl_easy_cleanup(curl);
}
return 0;
}
auto in_with_prompt = input_data(cin, true);
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
show_histogram_svg(bins_with_prompt);
return 0;
} }