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
+28
View File
@@ -0,0 +1,28 @@
#include "basic_io.hpp"
#include <sstream>
#include <string>
namespace fundamentals {
auto join_words(const std::vector<std::string>& words, char separator) -> std::string {
// TODO: Join words with separator, no trailing separator.
(void)words;
(void)separator;
return {};
}
auto parse_integers(const std::string& csv) -> std::vector<int> {
// TODO: Parse comma-separated integers (e.g. "1,2,3").
(void)csv;
return {};
}
auto format_score(const std::string& player, int score) -> std::string {
// TODO: Return "<player> scored <score> points".
(void)player;
(void)score;
return {};
}
} // namespace fundamentals
@@ -0,0 +1,11 @@
#include "hello_world.hpp"
namespace fundamentals {
auto greet(const char* name) -> const char* {
// TODO: Return a static string in the format "Hello, <name>!"
(void)name;
return "Hello, World!";
}
} // namespace fundamentals
+40
View File
@@ -0,0 +1,40 @@
#include "operators.hpp"
namespace fundamentals {
auto absolute_difference(int lhs, int rhs) -> int {
// TODO: Return |lhs - rhs| without using std::abs.
(void)lhs;
(void)rhs;
return 0;
}
auto is_in_range(int value, int min, int max) -> bool {
// TODO: Return true when min <= value <= max (inclusive).
(void)value;
(void)min;
(void)max;
return false;
}
auto count_set_bits(std::uint8_t value) -> int {
// TODO: Count how many bits are set to 1.
(void)value;
return 0;
}
auto logical_and(bool lhs, bool rhs) -> bool {
// TODO: Implement logical AND without using &&.
(void)lhs;
(void)rhs;
return false;
}
auto logical_or(bool lhs, bool rhs) -> bool {
// TODO: Implement logical OR without using ||.
(void)lhs;
(void)rhs;
return false;
}
} // namespace fundamentals
@@ -0,0 +1,43 @@
#include "variables_and_types.hpp"
namespace fundamentals {
auto add_integers(int lhs, int rhs) -> int {
// TODO: Return the sum.
(void)lhs;
(void)rhs;
return 0;
}
auto multiply_doubles(double lhs, double rhs) -> double {
// TODO: Return the product.
(void)lhs;
(void)rhs;
return 0.0;
}
auto is_even(std::int64_t value) -> bool {
// TODO: Return true when value is divisible by 2.
(void)value;
return false;
}
auto describe_type(int value) -> std::string {
// TODO: Return "int:" followed by the decimal representation.
(void)value;
return "int:0";
}
auto describe_type(double value) -> std::string {
// TODO: Return "double:" followed by the value with one decimal place.
(void)value;
return "double:0.0";
}
auto describe_type(bool value) -> std::string {
// TODO: Return "bool:true" or "bool:false".
(void)value;
return "bool:false";
}
} // namespace fundamentals