code:....
Этот коммит содержится в:
3
.gitignore
поставляемый
3
.gitignore
поставляемый
@@ -1,7 +1,4 @@
|
|||||||
/bin
|
/bin
|
||||||
/obj
|
/obj
|
||||||
111.c
|
|
||||||
lab01.cpp
|
lab01.cpp
|
||||||
lab_01.layout
|
lab_01.layout
|
||||||
git.ignore.c
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
void
|
void
|
||||||
find_minmax(vector<double> numbers, double& min, double& max) {
|
find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||||
min = numbers[0];
|
min = numbers[0];
|
||||||
max = numbers[0];
|
max = numbers[0];
|
||||||
for (double x : numbers) {
|
for (double x : numbers) {
|
||||||
@@ -20,7 +20,7 @@ vector<size_t> make_histogram(vector<double> numbers, size_t bin_count) {
|
|||||||
vector <size_t> bins(bin_count);
|
vector <size_t> bins(bin_count);
|
||||||
double min, max;
|
double min, max;
|
||||||
find_minmax(numbers, min, max);
|
find_minmax(numbers, min, max);
|
||||||
size_t countt;
|
size_t count;
|
||||||
double bin_size = (max - min) / bin_count;
|
double bin_size = (max - min) / bin_count;
|
||||||
for (size_t i = 0; i < numbers.size(); i++) {
|
for (size_t i = 0; i < numbers.size(); i++) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<Unit filename="histogram.h" />
|
<Unit filename="histogram.h" />
|
||||||
<Unit filename="histogram_internal.h" />
|
<Unit filename="histogram_internal.h" />
|
||||||
<Unit filename="main.cpp" />
|
<Unit filename="main.cpp" />
|
||||||
|
<Unit filename="marks.txt" />
|
||||||
<Unit filename="svg.cpp" />
|
<Unit filename="svg.cpp" />
|
||||||
<Unit filename="svg.h" />
|
<Unit filename="svg.h" />
|
||||||
<Unit filename="text.cpp" />
|
<Unit filename="text.cpp" />
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -16,7 +16,7 @@ input_data(){
|
|||||||
cin >> number_count;
|
cin >> number_count;
|
||||||
Input in;
|
Input in;
|
||||||
in.numbers.resize(number_count);
|
in.numbers.resize(number_count);
|
||||||
for(int i;i<number_count;i++)
|
for(size_t i=0;i<number_count;i++)
|
||||||
{
|
{
|
||||||
cin >> in.numbers[i];
|
cin >> in.numbers[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
#include "doctest.h"
|
#include "doctest.h"
|
||||||
#include "histogram_internal.h"
|
#include "histogram_internal.h"
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("distinct positive numbers") {
|
TEST_CASE("distinct positive numbers") {
|
||||||
double min = 0;
|
double min = 0;
|
||||||
double max = 0;
|
double max = 0;
|
||||||
find_minmax({1, 2}, min, max);
|
std::vector<double>v{2,1};
|
||||||
|
find_minmax(v, min, max);
|
||||||
CHECK(min == 1);
|
CHECK(min == 1);
|
||||||
CHECK(max == 2);
|
CHECK(max == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user