2026-08-11 17:40:36 +03:00
|
|
|
#include "conditionals.hpp"
|
|
|
|
|
|
|
|
|
|
namespace control_flow {
|
|
|
|
|
|
2026-08-12 09:09:41 +03:00
|
|
|
auto classify_score(const int score) -> Grade {
|
|
|
|
|
if (score >= 90) return Grade::A;
|
|
|
|
|
if (score >= 80) return Grade::B;
|
|
|
|
|
if (score >= 70) return Grade::C;
|
|
|
|
|
if (score >= 60) return Grade::D;
|
2026-08-11 17:40:36 +03:00
|
|
|
return Grade::F;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-12 09:09:41 +03:00
|
|
|
auto max_of_three(const int a, const int b, const int c) -> int {
|
|
|
|
|
if (a >= b) {
|
|
|
|
|
if (a >= c) return a;
|
|
|
|
|
if (c > a) return c;
|
|
|
|
|
}
|
|
|
|
|
if (b >= c) return b;
|
|
|
|
|
if (c > b) return c;
|
|
|
|
|
return -1;
|
2026-08-11 17:40:36 +03:00
|
|
|
}
|
|
|
|
|
|
2026-08-12 09:09:41 +03:00
|
|
|
auto sign_of(const int value) -> int {
|
|
|
|
|
return value == 0 ? 0 : value > 0 ? 1 : -1;
|
2026-08-11 17:40:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace control_flow
|