Ответ:
template<Number T>
class Sort_t
{
public:
Sort_t(T* old, size_t siz) :self(old),size(siz) {}
auto bubble() {
bool flag = 1;
for (size_t i = 0; i < size && flag; i++)
flag = 0;
for (size_t j = 0; j < size; j++)
if (self[i] < self[j])
swap_num(self[i], self[j]);
flag = 1;
}
return self;
auto &length() {
return size;
private:
T* self;
size_t size;
};
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
template<Number T>
class Sort_t
{
public:
Sort_t(T* old, size_t siz) :self(old),size(siz) {}
auto bubble() {
bool flag = 1;
for (size_t i = 0; i < size && flag; i++)
{
flag = 0;
for (size_t j = 0; j < size; j++)
{
if (self[i] < self[j])
{
swap_num(self[i], self[j]);
flag = 1;
}
}
}
return self;
}
auto &length() {
return size;
}
private:
T* self;
size_t size;
};
Объяснение: