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

..

Ничего общего в коммитах. '240e4a99aa7df9a25b39220d0bdb18f195b2b7c7' и 'e89c8cef003a7121e8854da3062cc72635ec3907' имеют совершенно разные истории.

1
.gitignore поставляемый

@ -1,4 +1,3 @@
/bin /bin
obj/ obj/
*.layout *.layout
curl/

@ -31,13 +31,7 @@
<Compiler> <Compiler>
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
<Add option="-DCURL_STATICLIB" />
<Add directory="C:/Users/Евгений/Desktop/laba N 3/Laba N 1/curl/include" />
</Compiler> </Compiler>
<Linker>
<Add library="libcurl.a" />
<Add directory="C:/Users/Евгений/Desktop/laba N 3/Laba N 1/curl/lib" />
</Linker>
<Unit filename="histogram.cpp" /> <Unit filename="histogram.cpp" />
<Unit filename="histogram.h" /> <Unit filename="histogram.h" />
<Unit filename="ignor.gitignore" /> <Unit filename="ignor.gitignore" />

@ -1,71 +1,31 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <curl/curl.h>
#include "text.h" #include "text.h"
#include "histogram.h" #include "histogram.h"
#include "svg.h" #include "svg.h"
#include "procent.h" #include "procent.h"
using namespace std; using namespace std;
struct Input { struct Input {
vector<double> numbers; std::vector<double> numbers;
size_t number_count{}; size_t number_count{};
size_t bin_count{}; size_t bin_count{};
size_t max_count{};
}; };
Input Input
input_data(istream& inn,bool prompt) { input_data() {
if(prompt== true) size_t number_count;
{
Input in; Input in;
cerr << "Enter number count: "; cin >> number_count;
inn >> in.number_count; in.numbers.resize(number_count);
vector<double> numbers(in.number_count); for (size_t i = 0; i < number_count; i++) {
in.numbers.resize(in.number_count); cin >> in.numbers[i];
for (size_t i = 0; i < in.number_count; i++) {
inn >> in.numbers[i];
} }
size_t bin_count; size_t bin_count;
cerr << "Enter bin count: "; cin >> in.bin_count;
inn >> in.bin_count;
size_t max_count;
in.max_count = 0;
return in; return in;
} }
if(prompt==false) int main()
{ {
Input in; auto in = input_data();
inn >> in.number_count;
vector<double> numbers(in.number_count);
in.numbers.resize(in.number_count);
for (size_t i = 0; i < in.number_count; i++) {
inn >> in.numbers[i];
}
size_t bin_count;
inn >> in.bin_count;
size_t max_count;
in.max_count = 0;
return in;
}
}
int main(int argc, char* argv[])
{
if(argc>1)
{
CURL* curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res!=0){
cout<<res;
exit(1);
}
}
return 0;
}
curl_global_init(CURL_GLOBAL_ALL);
auto in = input_data(cin,true);
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);
auto max_count=bins[0]; auto max_count=bins[0];

@ -19,6 +19,11 @@ svg_text(double left, double baseline, std::string text) {
std::cout << "<text x='"<< left <<"' y='"<< baseline <<"'>"<< text <<"</text>"; std::cout << "<text x='"<< left <<"' y='"<< baseline <<"'>"<< text <<"</text>";
} }
void
svg_proc(double left, double baseline) {
std::cout << "<text x='"<< left <<"' y='"<< baseline<<"</text>";
}
void svg_rect(double x, double y, double width, double height,std::string stroke = "black", std::string fill = "green"){ void svg_rect(double x, double y, double width, double height,std::string stroke = "black", std::string fill = "green"){
std::cout<< "<rect x='"<< x <<"' y='"<< y <<"' width='"<< width <<"' height='"<< height <<"' stroke = '" << stroke <<"' fill = '" << fill <<"' />"; std::cout<< "<rect x='"<< x <<"' y='"<< y <<"' width='"<< width <<"' height='"<< height <<"' stroke = '" << stroke <<"' fill = '" << fill <<"' />";
} }
@ -50,6 +55,7 @@ show_histogram_svg(std::vector<size_t> bins,size_t max_count) {
const auto TEXT_LEFT_PROCENT = SCALE+TEXT_WIDTH+20; const auto TEXT_LEFT_PROCENT = SCALE+TEXT_WIDTH+20;
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i])); svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT); svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT);
svg_proc(TEXT_LEFT_PROCENT, top + TEXT_BASELINE);
top += BIN_HEIGHT; top += BIN_HEIGHT;
}} }}
@ -59,9 +65,19 @@ show_histogram_svg(std::vector<size_t> bins,size_t max_count) {
const auto TEXT_LEFT_PROCENT = (max_count*SCALE)+TEXT_WIDTH+20; const auto TEXT_LEFT_PROCENT = (max_count*SCALE)+TEXT_WIDTH+20;
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i])); svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT); svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT);
svg_proc(TEXT_LEFT_PROCENT, top + TEXT_BASELINE);
top += BIN_HEIGHT; top += BIN_HEIGHT;
} }
svg_end(); svg_end();
} }
/*for (size_t i = 0; i < bins.size(); i++) {
const double bin_width = BLOCK_WIDTH * bins[i];
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bins[i]));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT);
svg_proc(BLOCK_WIDTH*bins[i]+TEXT_LEFT+50, top + TEXT_BASELINE,procent[i]);
top += BIN_HEIGHT;
} }
svg_end();
}*/}

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