From 4f7d3cd4f4218353d805294eeca46ae92ee931b6 Mon Sep 17 00:00:00 2001 From: Evy Garden <evysgarden@protonmail.com> Date: Fri, 1 Dec 2023 18:46:17 +0100 Subject: [PATCH] stylistic choices --- day01cpp/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/day01cpp/main.cpp b/day01cpp/main.cpp index 1eff43e..c146816 100644 --- a/day01cpp/main.cpp +++ b/day01cpp/main.cpp @@ -25,13 +25,12 @@ void part_a() { void part_b() { std::ifstream data("data.txt"); + std::string line; + uint32_t sum = 0; - constexpr std::array<std::string_view, 9> numbers + static constexpr std::array<std::string_view, 9> numbers = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; - std::string line; - uint32_t sum = 0; - while (std::getline(data, line)) { std::pair num_a { 0, line.size() }; for (size_t index = 0; index < numbers.size(); ++index) { -- GitLab