/
NeonBite
/
oop-first
Обзор
Документация
Войти
/
NeonBite
/
oop-first
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
lake.cpp
45 строк
1 KB
Winnie-the-Pooh2019
initial commit
15 фев 2026, 14:00
15 фев 2026, 14:00
bd5b494
Код
Авторство
О чём код?
// // Created by ivand on 2/3/2026. // #include <iostream> #include <sstream> #include "lake.h" Lake::Lake(double depth, double square, string name) { this->depth = depth; this->square = square; this->name = name; std::cout << "Lake created" << std::endl; this->volume = depth * square; } string Lake::to_str() { std::stringstream ss; ss << "Lake with name " << this->name << " depth = " << this->depth << " square = " << this->square << " volume = " << this->volume; return ss.str(); } vector<Lake> sortBubble(vector<Lake> lakes) { vector<Lake> sortedLakes = lakes; std::cout << "Sorting bubble" << std::endl; for (int i = 0; i < sortedLakes.size(); i++) { for (int j = i; j < sortedLakes.size(); j++) { if (sortedLakes[i].depth > sortedLakes[j].depth) { Lake temp = sortedLakes[i]; sortedLakes[i] = sortedLakes[j]; sortedLakes[j] = temp; } } } return sortedLakes; }