Solved: 06 - Conditionals

This commit is contained in:
2026-08-12 09:09:41 +03:00
parent bd85800a30
commit 3cce26e72d
+15 -10
View File
@@ -2,21 +2,26 @@
namespace control_flow { namespace control_flow {
auto classify_score(int score) -> Grade { auto classify_score(const int score) -> Grade {
// TODO: A>=90, B>=80, C>=70, D>=60, else F if (score >= 90) return Grade::A;
(void)score; if (score >= 80) return Grade::B;
if (score >= 70) return Grade::C;
if (score >= 60) return Grade::D;
return Grade::F; return Grade::F;
} }
auto max_of_three(int a, int b, int c) -> int { auto max_of_three(const int a, const int b, const int c) -> int {
(void)a; (void)b; (void)c; if (a >= b) {
return 0; if (a >= c) return a;
if (c > a) return c;
}
if (b >= c) return b;
if (c > b) return c;
return -1;
} }
auto sign_of(int value) -> int { auto sign_of(const int value) -> int {
// TODO: Return -1, 0, or 1 return value == 0 ? 0 : value > 0 ? 1 : -1;
(void)value;
return 0;
} }
} // namespace control_flow } // namespace control_flow