summaryrefslogtreecommitdiff
path: root/2023/02/src/part2.cpp
blob: 52b8fc871cad7ec027387032cd0e0f35d8e80c5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <algorithm>
#include <iostream>
#include <fstream>

#include "game.h"

int main(void)
{
    int answer{};
    std::vector<Game> games{};

    std::ifstream input{ "resources/input.txt" };
    if (input.is_open())
    {
        std::string line;

        while (not std::getline(input,line).eof())
        {
            games.push_back(Game::from_string(line));
        }
    }
    input.close();

    for (const auto& game : games)
    {
        answer += game.power();
    }

    std::cout << answer << std::endl;
    return 0;
}