Created base solution struct and added all 25 days

This commit is contained in:
Luke Else 2022-11-29 22:09:15 +00:00
parent da63d9593d
commit 60f49c2705
30 changed files with 135 additions and 5 deletions

View File

@ -127,6 +127,31 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\days\day01.cpp" />
<ClCompile Include="src\days\day02.cpp" />
<ClCompile Include="src\days\day03.cpp" />
<ClCompile Include="src\days\day04.cpp" />
<ClCompile Include="src\days\day05.cpp" />
<ClCompile Include="src\days\day06.cpp" />
<ClCompile Include="src\days\day07.cpp" />
<ClCompile Include="src\days\day08.cpp" />
<ClCompile Include="src\days\day09.cpp" />
<ClCompile Include="src\days\day10.cpp" />
<ClCompile Include="src\days\day11.cpp" />
<ClCompile Include="src\days\day12.cpp" />
<ClCompile Include="src\days\day13.cpp" />
<ClCompile Include="src\days\day14.cpp" />
<ClCompile Include="src\days\day15.cpp" />
<ClCompile Include="src\days\day16.cpp" />
<ClCompile Include="src\days\day17.cpp" />
<ClCompile Include="src\days\day18.cpp" />
<ClCompile Include="src\days\day19.cpp" />
<ClCompile Include="src\days\day20.cpp" />
<ClCompile Include="src\days\day21.cpp" />
<ClCompile Include="src\days\day22.cpp" />
<ClCompile Include="src\days\day23.cpp" />
<ClCompile Include="src\days\day24.cpp" />
<ClCompile Include="src\days\Source.cpp" />
<ClCompile Include="src\main.cpp" /> <ClCompile Include="src\main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -18,6 +18,81 @@
<ClCompile Include="src\main.cpp"> <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\days\Source.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day01.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day02.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day03.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day04.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day05.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day07.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day06.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day08.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day09.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day10.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day12.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day13.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day14.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day16.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day15.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day17.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day18.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day19.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day20.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day21.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day22.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day23.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\days\day24.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\aoc2022.h"> <ClInclude Include="src\aoc2022.h">

View File

@ -10,12 +10,13 @@ struct SDay {
SDay(std::string); SDay(std::string);
~SDay(); ~SDay();
virtual Output part1() const {}; virtual Output part1() const = 0;
virtual Output part2() const {}; virtual Output part2() const = 0;
}; };
template <typename Output> template <typename Output>
SDay<Output>::SDay(std::string name) { SDay<Output>::SDay(std::string name) {
this->name = name;
input.open("input/" + name, std::ios::in); input.open("input/" + name, std::ios::in);
} }

11
src/days/Source.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../aoc2022.h"
template <typename Output>
struct SDay01 : public SDay<Output> {
//Class constructor
using SDay<Output>::SDay;
//Solutions to both days
Output part1() const override final { return Output(); }
Output part2() const override final { return Output(); }
};

0
src/days/day01.cpp Normal file
View File

0
src/days/day02.cpp Normal file
View File

0
src/days/day03.cpp Normal file
View File

0
src/days/day04.cpp Normal file
View File

0
src/days/day05.cpp Normal file
View File

0
src/days/day06.cpp Normal file
View File

0
src/days/day07.cpp Normal file
View File

0
src/days/day08.cpp Normal file
View File

0
src/days/day09.cpp Normal file
View File

0
src/days/day10.cpp Normal file
View File

0
src/days/day11.cpp Normal file
View File

0
src/days/day12.cpp Normal file
View File

0
src/days/day13.cpp Normal file
View File

0
src/days/day14.cpp Normal file
View File

0
src/days/day15.cpp Normal file
View File

0
src/days/day16.cpp Normal file
View File

0
src/days/day17.cpp Normal file
View File

0
src/days/day18.cpp Normal file
View File

0
src/days/day19.cpp Normal file
View File

0
src/days/day20.cpp Normal file
View File

0
src/days/day21.cpp Normal file
View File

0
src/days/day22.cpp Normal file
View File

0
src/days/day23.cpp Normal file
View File

0
src/days/day24.cpp Normal file
View File

0
src/days/day25.cpp Normal file
View File

View File

@ -1,7 +1,25 @@
#include "aoc2022.h" #include "aoc2022.h"
#include <iostream>
#include <string> #include <string>
#include "days/Source.cpp"
void createDays() {
std::string fileName;
std::ofstream file;
for (int i = 1; i <= 25; i++)
{
if (i < 10)
{
file.open("src/days/day0" + std::to_string(i) + ".cpp");
}
else
{
file.open("src/days/day" + std::to_string(i) + ".cpp");
}
file.close();
}
}
int main() { int main() {
SDay01<int> day1("day01");
createDays();
} }