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

..

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

@ -17,7 +17,7 @@ int main()
Input in = input_data();
std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins);
show_histogram_text(bins, in.bin_count);
return 0;
}
Input input_data() {
@ -27,14 +27,15 @@ Input input_data() {
cin >> countOfNumbers;
input_struct.numbers.resize(countOfNumbers);
cerr << "Input bin count:\n";
cin >> input_struct.bin_count;
cerr << "Input numbers:\n";
for (int i = 0; i < countOfNumbers; i++) {
cerr << i << ":" << endl;
cin >> input_struct.numbers[i];
}
cerr << endl;
cerr << "Input bin count:\n";
cin >> input_struct.bin_count;
return input_struct;
}

@ -1,5 +1,4 @@
#include "svg.h"
#include "text.h"
void svg_begin(double width, double height) {
std::cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
std::cout << "<svg ";
@ -14,30 +13,6 @@ void svg_end() {
}
void show_histogram_svg(const std::vector<size_t>& bins) {
const auto IMAGE_WIDTH = 400;
const auto IMAGE_HEIGHT = 300;
const auto TEXT_LEFT = 20;
const auto TEXT_BASELINE = 20;
const auto TEXT_WIDTH = 50;
const auto BIN_HEIGHT = 30;
const auto BLOCK_WIDTH = 10;
svg_begin(400, 300);
size_t maxCount = maxBin(bins);
double top = 0;
for (size_t bin : bins) {
const double bin_width = (IMAGE_WIDTH - TEXT_WIDTH) * (bin / double(maxCount));
svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bin));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT,"red","#006B3C");
top += BIN_HEIGHT;
}
svg_end();
}
void svg_text(double left, double baseline, std::string text) {
std::cout << "<text x='" << left << "' y='"<< baseline <<"'>" << text<<"</text>";
}
void svg_rect(double x, double y, double width, double height,std::string stroke="black", std::string fills="black"){
std::cout << "<rect x='"<<x<<"' y='"<<y<<"' width='"<<width<<"' height='"<<height<<"' stroke='"<<stroke<<"' fill='"<<fills<<"' />";
}

@ -6,7 +6,5 @@
void svg_begin(double width, double height);
void svg_end();
void show_histogram_svg(const std::vector<size_t>& bins);
void svg_text(double left, double baseline, std::string text);
void svg_rect(double x, double y, double width, double height,std::string stroke, std::string fills);
#endif // SVG_H_INCLUDED

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