Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
28d08cd
реализация addition
GushchinAndrei1 Nov 25, 2025
74d74df
Update testing.yml
GushchinAndrei1 Nov 25, 2025
69700c1
реализация print_bits.cpp
GushchinAndrei1 Nov 26, 2025
c4df47e
Merge branch 'development' of github.com:GushchinAndrei1/psds-cpp-202…
GushchinAndrei1 Nov 26, 2025
b83a96f
реализация print_bits.cpp
GushchinAndrei1 Nov 26, 2025
9ac64e2
Update testing.yml
GushchinAndrei1 Nov 26, 2025
62eec26
Update testing.yml
GushchinAndrei1 Nov 28, 2025
934f30d
реализация rms
GushchinAndrei1 Nov 28, 2025
7b75756
реализцаия check_flags
GushchinAndrei1 Nov 28, 2025
8b8b294
реализация length
GushchinAndrei1 Nov 28, 2025
ef05ef7
реализация quadratic
GushchinAndrei1 Nov 28, 2025
ac1a145
Update testing.yml
GushchinAndrei1 Nov 28, 2025
3c0000c
небольшая корректровка, добавление values == nullptr
GushchinAndrei1 Nov 28, 2025
d49f95d
реализация char_changer
GushchinAndrei1 Nov 30, 2025
9eb26d0
resolve conflict in testing.yml
GushchinAndrei1 Dec 2, 2025
7977551
Update testing.yml
GushchinAndrei1 Dec 2, 2025
a328691
реализация swap_ptr
GushchinAndrei1 Dec 3, 2025
25e327f
Merge branch 'development' of github.com:GushchinAndrei1/psds-cpp-202…
GushchinAndrei1 Dec 3, 2025
0ed0241
реализация func_array
GushchinAndrei1 Dec 4, 2025
23c09fd
реализация func_array
GushchinAndrei1 Dec 4, 2025
dc7e2ca
доработка swap_ptr
GushchinAndrei1 Dec 6, 2025
31c0c0e
реализация longest
GushchinAndrei1 Dec 6, 2025
aba1f07
реализация last_of_us
GushchinAndrei1 Dec 6, 2025
fa0ab69
fix
GushchinAndrei1 Dec 7, 2025
1ddb73c
исправление конфликтов
GushchinAndrei1 Dec 7, 2025
31865a2
Fix test.cpp
GushchinAndrei1 Dec 7, 2025
376dc49
Sync pretty_array from main
GushchinAndrei1 Dec 7, 2025
92a4646
Merge branch 'main' of https://github.com/psds-cpp/psds-cpp-2025
GushchinAndrei1 Dec 15, 2025
bad9fac
реализция find_all
GushchinAndrei1 Dec 18, 2025
73dda22
реализация filter
GushchinAndrei1 Dec 18, 2025
430377f
реализация minmax
GushchinAndrei1 Dec 18, 2025
763f027
реализация easy_compare
GushchinAndrei1 Dec 18, 2025
693b5e1
реализация enum_operators
GushchinAndrei1 Dec 18, 2025
ce82262
реализация data_stats
GushchinAndrei1 Dec 18, 2025
fb9f719
Sync 03_week from main
GushchinAndrei1 Dec 18, 2025
c4492a4
Merge branch 'main' of github.com:GushchinAndrei1/psds-cpp-2025
GushchinAndrei1 Dec 18, 2025
573eb1a
Merge branch '03_week' into development
GushchinAndrei1 Dec 18, 2025
e85e397
Merge branch 'main' of github.com:psds-cpp/psds-cpp-2025
18thday Dec 23, 2025
7791b0b
Merge remote-tracking branch 'upstream/main'
GushchinAndrei1 Dec 25, 2025
5904d15
Merge branch 'main' of github.com:GushchinAndrei1/psds-cpp-2025
GushchinAndrei1 Dec 25, 2025
97e08fb
add 04_week
GushchinAndrei1 Dec 25, 2025
e501d48
реализация phasor
GushchinAndrei1 Dec 26, 2025
4a8c62c
реализация queue
GushchinAndrei1 Dec 26, 2025
baa82f3
реализация ring_buffer
GushchinAndrei1 Dec 26, 2025
0a9a361
подятнул testing.yml
GushchinAndrei1 Dec 26, 2025
6cd86bd
Add 05_week
GushchinAndrei1 Feb 9, 2026
f89ed91
add 05_week
GushchinAndrei1 Feb 9, 2026
f66a69f
Update
GushchinAndrei1 Feb 10, 2026
597103a
update
GushchinAndrei1 Feb 10, 2026
ea2b381
update string_view
GushchinAndrei1 Feb 13, 2026
c7c58e0
Update string_view
GushchinAndrei1 Feb 13, 2026
501ec60
update string_view test
GushchinAndrei1 Feb 14, 2026
e933510
Update string_view test.cpp
GushchinAndrei1 Feb 14, 2026
7d50015
реализация
GushchinAndrei1 Feb 16, 2026
95cf658
Merge upstream/main
GushchinAndrei1 Feb 28, 2026
5df481d
Merge development into main
GushchinAndrei1 Feb 28, 2026
f7bfa45
реализация
GushchinAndrei1 Mar 7, 2026
3c49912
Merge remote-tracking branch 'upstream/main'
GushchinAndrei1 Mar 7, 2026
ae15ec0
Реализация array
GushchinAndrei1 Mar 10, 2026
2281043
Реализация make_unique
GushchinAndrei1 Mar 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/testing_week_01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
if [["${{ github.event_name }}" = "schedule"]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_week_02.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
if [["${{ github.event_name }}" = "schedule"]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_week_03.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
if [["${{ github.event_name }}" = "schedule"]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_week_04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
if [["${{ github.event_name }}" = "schedule"]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testing_week_05.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- simple_vector

schedule:
- cron: '59 20 17 02 *' # UTC: 20:59 = 23:59 MSK 17 February
- cron: '59 20 16 02 *' # UTC: 20:59 = 23:59 MSK 16 February

jobs:
test:
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
if [["${{ github.event_name }}" = "schedule"]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
Expand Down
13 changes: 8 additions & 5 deletions 01_week/tasks/addition/addition.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#include <cstdint>
#include <stdexcept>

#include <cstddef> // заголовочный файл с целочисленными типами фиксированного размера
#include <stdexcept> // из этого мы ничего не используем

// функция принимает две перменных типа int и возвращает число типа int64_t
int64_t Addition(int a, int b) {
throw std::runtime_error{"Not implemented"};
}

// Чтобы сложение выполнялось в int64_t, приводим a и b к этому типу
// static_cast<новый тип>(переменная)
return static_cast<int64_t>(a) + static_cast<int64_t>(b);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишний каст, достаточно явно кастовать только один операнд, второй будет неявно преобразован, необходимо использовать данную возможность языка и не писать лишний код

}
87 changes: 84 additions & 3 deletions 01_week/tasks/char_changer/char_changer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,88 @@
#include <cstddef>
#include <stdexcept>

#include <cctype> // применял isspace, isdigit, isupper, islower, toupper

size_t CharChanger(char array[], size_t size, char delimiter = ' ') {
throw std::runtime_error{"Not implemented"};
if (size == 0) {
return 0;
}

size_t read = 0; // это индекс для чтения
size_t write = 0; // это индекс для запси символов

// идем по массиву пока не выйдем за него
// и пока текущий символ не конец строки, конец строки по условию это '\0'
while (read < size && array[read] != '\0') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

много лишних комментариев, невозможно читать код

// в cppreference указано, что isspace должно принимать безнаковый символ,
// поэтому преобразуем текущий символ из char в unsigned char
unsigned char uc = static_cast<unsigned char>(array[read]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

данное преобразование произойдет неявно, это лишний каст

// если текущий символ пробельный
if (std::isspace(uc)) {

// пропускаем все подряд идущие пробельные символы
while (read < size && array[read] != '\0') {
unsigned char c = static_cast<unsigned char>(array[read]);
if (!std::isspace(c)) {
break; // текущий символ больше не пробел — выходим
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проблемы с отступами

++read; // пробел — пропускаем и идём дальше
}
// теперь когда мы прочитали все пробелы записывыем в write только один пробел
array[write++] = delimiter;

} else {
// Теперь рассматриваем случай когда у нас идут подряд одинаковые символы
// Текущий символ массива
char current = array[read];
size_t count = 0; // это как счетчик, то есть сколько повторябщихся символов
// идем пока текущий символ не превзойдет размер массива и
// символ не конец строки и символ на текущей позиции такой же как и currentт
while (read < size && array[read] != '\0' && array[read] == current) {
++count;
++read;
}

// Определяем, какой символ писать по правилам
// в cppreference указано, что isdigit,isupper,islower должно принимать безнаковый символ,
// поэтому преобразуем текущий символ current из char в unsigned char
unsigned char cu = static_cast<unsigned char>(current);
char Char;

if (std::isdigit(cu)) { // цифры заменяем на '*'
Char = '*';
} else if (std::isupper(cu)) { //прописные латинские не меняем
Char = current;
} else if (std::islower(cu)) { // строчные на прописные
Char = static_cast<char>(std::toupper(cu));
} else { // остальное на '_'
Char = '_';
}

// записываем символ в write
array[write++] = Char;

// пишем количество повторений, если count > 1
if (count > 1) {
if (count >= 10) { // Если повторений не менее 10, указывается `0` после символа
array[write++] = '0';
} else {
// записываем в write число посторений (то есть елси 2222, то 4),
// Например, если было "2222", то count = 4, и мы должны записать символ '4'.
// В кодировке ASCII код символа '0' равен 48
// Поэтому, чтобы получить символ '4', берём код '0' (48) и прибавляем 4 (48 + 4 = 52 — это код '4')
array[write++] = static_cast<char>('0' + count); //
}
}
}
}

// завершаем строку
if (write >= size) {
write = size - 1;
}
array[write] = '\0';

return write;
}



87 changes: 81 additions & 6 deletions 01_week/tasks/check_flags/check_flags.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <cstdint>
#include <stdexcept>
#include <cstdint>
#include <stdexcept>


enum class CheckFlags : uint8_t {
// каждый флаг это один бит в маске, флаг занимает ровно один
enum class CheckFlags : uint8_t {
NONE = 0,
TIME = (1 << 0),
DATE = (1 << 1),
Expand All @@ -12,7 +12,82 @@ enum class CheckFlags : uint8_t {
DEST = (1 << 5),
ALL = TIME | DATE | USER | CERT | KEYS | DEST
};
void PrintCheckFlags(CheckFlags flags) {
// мы не можем напрямую работать с flags, поэтому преобразуем
// flags из типа CheckFlags в обычное число типа uint8_t
// uint8_t потому что все флаги храняться в одном байте
uint8_t mask = static_cast<uint8_t>(flags);
// так как маска = 8 бит, то и все разрешенные флаги тоже 8 бит (поэтому uint8_t)
// но в целом как для mask, так и для allowedFlags могли написать int и не париться, но с uint8_t корректнее
uint8_t allowedFlags = static_cast<uint8_t>(CheckFlags::ALL);

// Если передано значение выходит из возможного диапазона значений, то вывод следует оставить пустым.
// к примеру если мы на вход подаем значение 128, а 128 в двочиной это 10000000 (mask), allowedFlags = 01111111, то
// 10000000
// 11000000 (инверсия)
// --------
// 10000000 (такого флага в маске нет)
if (mask & ~allowedFlags) {
return;
}

// Если передан флаг отсутствия проверок, то выводим пустые `[]`
if (mask == 0) {
std::cout << "[]";
return;
}

// дальше расматриваем все возможные случаи проверок
std::cout << "[";
// флаг состояний для запятой
bool first = true;

if (mask & static_cast<uint8_t>(CheckFlags::TIME)) {
if (!first) {
std::cout << ",";
}
std::cout << "TIME";
first = false;
}

if (mask & static_cast<uint8_t>(CheckFlags::DATE)) {
if (!first) {
std::cout << ",";
}
std::cout << "DATE";
first = false;
}

if (mask & static_cast<uint8_t>(CheckFlags::USER)) {
if (!first) {
std::cout << ",";
}
std::cout << "USER";
first = false;
}

if (mask & static_cast<uint8_t>(CheckFlags::CERT)) {
if (!first) {
std::cout << ",";
}
std::cout << "CERT";
first = false;
}

if (mask & static_cast<uint8_t>(CheckFlags::KEYS)) {
if (!first) {
std::cout << ",";
}
std::cout << "KEYS";
first = false;
}

if (mask & static_cast<uint8_t>(CheckFlags::DEST)) {
if (!first) {
std::cout << ",";
}
std::cout << "DEST";
}

void PrintCheckFlags(CheckFlags flags) {
throw std::runtime_error{"Not implemented"};
std::cout << "]";
}
62 changes: 62 additions & 0 deletions 01_week/tasks/length_lit/length_lit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// в метрах
const double INCH = 0.0254;
const double FOOT = 0.3048;
const double CM = 0.01;

// перевод из дюймов в метры
double operator"" _in_to_m(long double v) {
return v * INCH;
}
// перевод из дюймов в сантиметры
double operator"" _in_to_cm(long double v) {
double m = v * INCH;
return m / CM;
}
// перевод из дюймов в футы
double operator"" _in_to_ft(long double v) {
double m = v * INCH;
return m / FOOT;
}

// перевод из футов в метры
double operator"" _ft_to_m(long double v) {
return v * FOOT;
}
// перевод из футов в сантиметры
double operator"" _ft_to_cm(long double v) {
double m = v * FOOT;
return m / CM;
}
// перевод из футов в дюймы
double operator"" _ft_to_in(long double v) {
double m = v * FOOT;
return m / INCH;
}

// перевод из сантиметров в метры
double operator"" _cm_to_m(long double v) {
return v * CM;
}
// перевод из сантиметров в дюймы
double operator"" _cm_to_in(long double v) {
double m = v * CM;
return m / INCH;
}
// перевод из сантиметров в футы
double operator"" _cm_to_ft(long double v) {
double m = v * CM;
return m / FOOT;
}

// перевод из метров в сантиметры
double operator"" _m_to_cm(long double v) {
return v / CM;
}
// перевод из метров в дюймы
double operator"" _m_to_in(long double v) {
return v / INCH;
}
// перевод из метров в футы
double operator"" _m_to_ft(long double v) {
return v / FOOT;
}
27 changes: 25 additions & 2 deletions 01_week/tasks/print_bits/print_bits.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
#include <cstddef>
#include <stdexcept>


// value - целое число, его нужно вывести в двоичной форме
// bytes типа size_t потому что bytes это количсевто байт
void PrintBits(long long value, size_t bytes) {
throw std::runtime_error{"Not implemented"};
// по условию мы не можем выполнить функцию когда у нас
// количсевто байт = 0, либо количесвто байт > 8
if (bytes == 0 || bytes > 8) {
return;
}
// Считаем общее количсевто бит, 1 байт = 1 бит
size_t bits = bytes * 8;
// выводим префикс "0b", дальше будет идти предствление числа
std::cout << "0b";
// цикл будет выполняться bits раз
for (size_t i = 0; i < bits; ++i) {
size_t bit_index = bits - 1 - i;
// побитовый сдвиг, сравниваем младший бит с 1 и выводим результат
std::cout << ((value >> bit_index) & 1);

// если i + 1 делится на 4 без остатка и это не полседний бит,
// ставим "'"
if ((i + 1) % 4 == 0 && (i + 1) != bits) {
std::cout << "'";
}
}
// перевод строки
std::cout << '\n';
}
Loading