Files
cpp-course/modules/02_control_flow/src/conditionals.cpp
T
2026-08-12 13:49:55 +03:00

27 lines
579 B
C++

#include "conditionals.hpp"
namespace control_flow {
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;
return Grade::F;
}
auto max_of_three(const int a, const int b, const int c) -> int {
if (a >= b) {
if (a >= c) return a;
return c;
}
if (b >= c) return b;
return c;
}
auto sign_of(const int value) -> int {
return value == 0 ? 0 : value > 0 ? 1 : -1;
}
} // namespace control_flow