summaryrefslogtreecommitdiff
path: root/2023/02/src/part1.cpp
diff options
context:
space:
mode:
Diffstat (limited to '2023/02/src/part1.cpp')
-rw-r--r--2023/02/src/part1.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/2023/02/src/part1.cpp b/2023/02/src/part1.cpp
new file mode 100644
index 0000000..c9fe48c
--- /dev/null
+++ b/2023/02/src/part1.cpp
@@ -0,0 +1,33 @@
1#include <iostream>
2#include <fstream>
3
4#include "game.h"
5
6int main(void)
7{
8 int answer{};
9 std::vector<Game> games{};
10
11 std::ifstream input{ "resources/input.txt" };
12 if (input.is_open())
13 {
14 std::string line;
15
16 while (not std::getline(input,line).eof())
17 {
18 games.push_back(Game::from_string(line));
19 }
20 }
21 input.close();
22
23 for (const auto& game : games)
24 {
25 if (game.is_valid(14, 12, 13))
26 {
27 answer += game.id();
28 }
29 }
30
31 std::cout << answer << std::endl;
32 return 0;
33}