Solved: 07 - Loops

Added a contract precondition to factorial
This commit is contained in:
David Gil de Gómez Pérez
2026-08-12 14:47:10 +03:00
parent ba6d3ea5d4
commit 88cc7728a6
3 changed files with 36 additions and 14 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
namespace control_flow {
[[nodiscard]] auto sum_range(int from, int to) -> int;
[[nodiscard]] auto factorial(int n) -> long long;
// ReSharper disable once CppConstParameterInDeclaration
[[nodiscard]] auto factorial(const int n) -> long long pre(n >= 0);
[[nodiscard]] auto count_occurrences(const std::vector<int>& data, int target) -> int;
[[nodiscard]] auto first_index_of(const std::vector<int>& data, int target) -> int;