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

..

Ничего общего в коммитах. '13ddf411a651c9b69232024daa2574750b9d976c' и '7066d4ac5fc04dd30be699b20bd2d0079275a747' имеют совершенно разные истории.

@ -2,7 +2,6 @@
#include <conio.h> #include <conio.h>
#include <vector> #include <vector>
#include <stdlib.h> #include <stdlib.h>
#include <string>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg01.h" #include "svg01.h"
@ -11,8 +10,6 @@ using namespace std;
struct Input { struct Input {
vector<double> numbers; vector<double> numbers;
size_t bin_count{}; size_t bin_count{};
string stroke;
string fill;
}; };
Input Input
@ -33,13 +30,6 @@ input_data(){
cerr << "Enter bin count: "; cerr << "Enter bin count: ";
cin >> in.bin_count; cin >> in.bin_count;
cerr << "Enter the color for the stroke: ";
cin >> in.stroke;
cerr << "Enter the color to fill: ";
cin >> in.fill;
return in; return in;
} }
@ -48,6 +38,6 @@ int main()
auto in = input_data(); auto in = input_data();
std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count); std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins, in.stroke, in.fill); show_histogram_svg(bins);
return 0; return 0;
} }

@ -1,7 +1,6 @@
#include "svg01.h" #include "svg01.h"
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <string>
using namespace std; using namespace std;
@ -26,12 +25,13 @@ svg_text(double left, double baseline, string text) {
} }
void void
svg_rect(double x, double y, double width, double height, string stroke, string fill){ svg_rect(double x, double y, double width, double height, string stroke = "midnightblue", string fill = "deeppink"){
cout << "<rect x='" << x << "' y='" << y << "' width='" << width << "' height='" << height << "' stroke='" << stroke << "' fill='" << fill << "'/>"; cout << "<rect x='" << x << "' y='" << y << "' width='" << width << "' height='" << height << "' stroke='" << stroke << "' fill='" << fill << "'/>";
} }
void void
show_histogram_svg(const vector<size_t>& bins, string stroke, string fill) { show_histogram_svg(const vector<size_t>& bins) {
const auto IMAGE_WIDTH = 400; const auto IMAGE_WIDTH = 400;
const auto IMAGE_HEIGHT = 300; const auto IMAGE_HEIGHT = 300;
const auto TEXT_LEFT = 20; const auto TEXT_LEFT = 20;
@ -51,7 +51,7 @@ show_histogram_svg(const vector<size_t>& bins, string stroke, string fill) {
for (size_t bin : bins) { for (size_t bin : bins) {
const double bin_width = (( IMAGE_WIDTH - TEXT_WIDTH ) / BLOCK_WIDTH ) * ( bin / maxel ); const double bin_width = (( IMAGE_WIDTH - TEXT_WIDTH ) / BLOCK_WIDTH ) * ( bin / maxel );
svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin)); svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, stroke, fill); svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT);
top += BIN_HEIGHT; top += BIN_HEIGHT;
} }
svg_end(); svg_end();

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
void void
show_histogram_svg(const std::vector<size_t>& bins, std::string stroke, std::string fill); show_histogram_svg(const std::vector<size_t>& bins);

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