Сравнить коммиты
2 Коммитов
bb51ae70ea
...
ee9b12fc4f
| Автор | SHA1 | Дата | |
|---|---|---|---|
| ee9b12fc4f | |||
| 30304c0921 |
16
lab1.depend
16
lab1.depend
@@ -1,19 +1,15 @@
|
||||
# depslib dependency file v1.0
|
||||
1747403061 source:c:\users\professional\desktop\cs-lab34\lab1\histogram.cpp
|
||||
1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\histogram.cpp
|
||||
"histogram.h"
|
||||
|
||||
1747403061 c:\users\professional\desktop\cs-lab34\lab1\histogram.h
|
||||
1747403716 c:\users\professional\desktop\cs-lab34\lab1\histogram.h
|
||||
<vector>
|
||||
<iostream>
|
||||
|
||||
1746444035 source:c:\users\professional\desktop\cs-lab34\lab1\text.cpp
|
||||
1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\text.cpp
|
||||
"text.h"
|
||||
"histogram.h"
|
||||
<iostream>
|
||||
<vector>
|
||||
<string>
|
||||
|
||||
1747403061 c:\users\professional\desktop\cs-lab34\lab1\text.h
|
||||
1747403716 c:\users\professional\desktop\cs-lab34\lab1\text.h
|
||||
<iostream>
|
||||
<vector>
|
||||
|
||||
@@ -22,12 +18,12 @@
|
||||
"text.h"
|
||||
"svg.h"
|
||||
|
||||
1747403061 c:\users\professional\desktop\cs-lab34\lab1\svg.h
|
||||
1747403716 c:\users\professional\desktop\cs-lab34\lab1\svg.h
|
||||
<iostream>
|
||||
<vector>
|
||||
<string>
|
||||
<math.h>
|
||||
|
||||
1747403061 source:c:\users\professional\desktop\cs-lab34\lab1\svg.cpp
|
||||
1747403716 source:c:\users\professional\desktop\cs-lab34\lab1\svg.cpp
|
||||
"svg.h"
|
||||
|
||||
|
||||
37
main.cpp
37
main.cpp
@@ -1,28 +1,45 @@
|
||||
#include "histogram.h"
|
||||
#include "text.h"
|
||||
#include "svg.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct Input {
|
||||
vector<double> vec;
|
||||
size_t korz{};
|
||||
};
|
||||
Input input_data() {
|
||||
Input in;
|
||||
|
||||
Input input_data(istream &in, bool prompt) {
|
||||
Input data;
|
||||
size_t n, korz;
|
||||
|
||||
if (prompt) {
|
||||
cerr << "Number of elements: ";
|
||||
cin >> n;
|
||||
in.vec.resize(n);
|
||||
}
|
||||
in >> n;
|
||||
data.vec.resize(n);
|
||||
|
||||
if (prompt) {
|
||||
cerr << "Elements: ";
|
||||
}
|
||||
for (size_t i = 0; i < n; i++)
|
||||
cin >> in.vec[i];
|
||||
in >> data.vec[i];
|
||||
|
||||
if (prompt) {
|
||||
cerr << "Enter bin count: ";
|
||||
cin >> in.korz;
|
||||
return in;
|
||||
}
|
||||
in >> korz;
|
||||
data.korz = korz;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto in = input_data();
|
||||
auto bins = make_histogram(in.korz, in.vec);
|
||||
show_histogram_svg(bins);
|
||||
|
||||
auto in_with_prompt = input_data(cin, true);
|
||||
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
|
||||
show_histogram_svg(bins_with_prompt);
|
||||
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user