Initial Course

This commit is contained in:
David Gil de Gómez Pérez
2026-08-11 17:40:36 +03:00
commit 9aed1d1d86
202 changed files with 3420 additions and 0 deletions
@@ -0,0 +1,20 @@
#include "break_continue.hpp"
namespace control_flow {
auto sum_positive(const std::vector<int>& data) -> int {
(void)data;
return 0;
}
auto first_multiple_of(const std::vector<int>& data, int divisor) -> int {
(void)data; (void)divisor;
return -1;
}
auto collect_until_negative(const std::vector<int>& data) -> std::vector<int> {
(void)data;
return {};
}
} // namespace control_flow
@@ -0,0 +1,22 @@
#include "conditionals.hpp"
namespace control_flow {
auto classify_score(int score) -> Grade {
// TODO: A>=90, B>=80, C>=70, D>=60, else F
(void)score;
return Grade::F;
}
auto max_of_three(int a, int b, int c) -> int {
(void)a; (void)b; (void)c;
return 0;
}
auto sign_of(int value) -> int {
// TODO: Return -1, 0, or 1
(void)value;
return 0;
}
} // namespace control_flow
+26
View File
@@ -0,0 +1,26 @@
#include "loops.hpp"
namespace control_flow {
auto sum_range(int from, int to) -> int {
(void)from; (void)to;
return 0;
}
auto factorial(int n) -> long long {
(void)n;
return 1;
}
auto count_occurrences(const std::vector<int>& data, int target) -> int {
(void)data; (void)target;
return 0;
}
auto first_index_of(const std::vector<int>& data, int target) -> int {
// TODO: Return index or -1 if not found
(void)data; (void)target;
return -1;
}
} // namespace control_flow
@@ -0,0 +1,21 @@
#include "switch_statements.hpp"
namespace control_flow {
auto parse_operation(char op) -> Operation {
(void)op;
return Operation::Unknown;
}
auto apply_operation(Operation op, int lhs, int rhs) -> int {
(void)op; (void)lhs; (void)rhs;
return 0;
}
auto day_name(int day) -> std::string {
// TODO: 1=Monday ... 7=Sunday, else "Invalid"
(void)day;
return "Invalid";
}
} // namespace control_flow