code:svg_2[5]
Этот коммит содержится в:
7
main.cpp
7
main.cpp
@@ -17,7 +17,7 @@ int main()
|
||||
|
||||
Input in = input_data();
|
||||
std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_text(bins, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
return 0;
|
||||
}
|
||||
Input input_data() {
|
||||
@@ -27,15 +27,14 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
4
svg.cpp
4
svg.cpp
@@ -14,5 +14,9 @@ void svg_end() {
|
||||
|
||||
void show_histogram_svg(const std::vector<size_t>& bins) {
|
||||
svg_begin(400, 300);
|
||||
svg_text(20, 20, std::to_string(bins[0]));
|
||||
svg_end();
|
||||
}
|
||||
void svg_text(double left, double baseline, std::string text) {
|
||||
std::cout << "<text x='" << left << "' y='35'>anything you want</text>";
|
||||
}
|
||||
|
||||
1
svg.h
1
svg.h
@@ -6,5 +6,6 @@
|
||||
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);
|
||||
|
||||
#endif // SVG_H_INCLUDED
|
||||
|
||||
Ссылка в новой задаче
Block a user