rebuild input_data
Этот коммит содержится в:
@@ -2,26 +2,26 @@
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
Input input_data() {
|
||||
Input in;
|
||||
Input input_data(std::istream& in, bool prompt) {
|
||||
Input data;
|
||||
size_t number_count;
|
||||
|
||||
std::cerr << "Enter number count: ";
|
||||
std::cin >> number_count;
|
||||
if (prompt) std::cerr << "Enter number count: ";
|
||||
in >> number_count;
|
||||
|
||||
in.numbers.resize(number_count);
|
||||
std::cerr << "Enter " << number_count << " numbers: ";
|
||||
data.numbers.resize(number_count);
|
||||
if (prompt) std::cerr << "Enter " << number_count << " numbers: ";
|
||||
for (size_t i = 0; i < number_count; i++) {
|
||||
std::cin >> in.numbers[i];
|
||||
in >> data.numbers[i];
|
||||
}
|
||||
|
||||
std::cerr << "Enter bin count: ";
|
||||
std::cin >> in.bin_count;
|
||||
if (prompt) std::cerr << "Enter bin count: ";
|
||||
in >> data.bin_count;
|
||||
|
||||
std::cerr << "Enter text width : ";
|
||||
std::cin >> in.width;
|
||||
if (prompt) std::cerr << "Enter text width : ";
|
||||
in >> data.width;
|
||||
|
||||
return in;
|
||||
return data;
|
||||
}
|
||||
|
||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
struct Input {
|
||||
@@ -8,6 +8,6 @@ struct Input {
|
||||
int width;
|
||||
};
|
||||
|
||||
Input input_data();
|
||||
Input input_data(std::istream& in, bool prompt);
|
||||
std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
||||
void show_histogram_text(const std::vector<size_t>& bins);
|
||||
|
||||
@@ -38,14 +38,15 @@
|
||||
"histogram.h"
|
||||
"svg.h"
|
||||
|
||||
1749169080 c:\mpei\programming\c++ 2sem\lab03\alex\project\histogram.h
|
||||
1749593919 c:\mpei\programming\c++ 2sem\lab03\alex\project\histogram.h
|
||||
<iostream>
|
||||
<vector>
|
||||
|
||||
1749162416 c:\mpei\programming\c++ 2sem\lab03\alex\project\text.h
|
||||
<iostream>
|
||||
<vector>
|
||||
|
||||
1749168172 c:\mpei\programming\c++ 2sem\lab03\alex\project\svg.h
|
||||
1749584700 c:\mpei\programming\c++ 2sem\lab03\alex\project\svg.h
|
||||
<vector>
|
||||
<iostream>
|
||||
|
||||
@@ -54,7 +55,7 @@
|
||||
<iostream>
|
||||
<limits>
|
||||
|
||||
1749170885 source:c:\mpei\programming\c++ 2sem\lab03\alex\project\svg.cpp
|
||||
1749584700 source:c:\mpei\programming\c++ 2sem\lab03\alex\project\svg.cpp
|
||||
"svg.h"
|
||||
"text.h"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="214" topLine="0" />
|
||||
</Cursor>
|
||||
|
||||
4
main.cpp
4
main.cpp
@@ -1,10 +1,10 @@
|
||||
#include "histogram.h"
|
||||
#include "svg.h"
|
||||
#include <sstream>
|
||||
|
||||
int main() {
|
||||
auto in = input_data();
|
||||
auto in = input_data(std::cin, true);
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_svg(bins, in.width);
|
||||
return 0;
|
||||
}
|
||||
//h hjhbhbjbh
|
||||
|
||||
Ссылка в новой задаче
Block a user