From 26306cdefb7eb447f727621084f4e2514f42c0cd Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Sat, 8 Dec 2018 23:34:14 +0100 Subject: [PATCH] Remove unnecessary braces --- Day8/Day8A.cpp | 9 +++------ Day8/Day8B.cpp | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Day8/Day8A.cpp b/Day8/Day8A.cpp index f03e994..fc621f3 100644 --- a/Day8/Day8A.cpp +++ b/Day8/Day8A.cpp @@ -7,9 +7,8 @@ std::vector read_input() input.reserve(20000); int i = 0; - while (std::cin >> i) { + while (std::cin >> i) input.push_back(i); - } return input; } @@ -20,13 +19,11 @@ int read_node(std::vector::iterator &it) int meta_count = *it++; int value = 0; - for (int i = 0; i < child_count; i++) { + for (int i = 0; i < child_count; i++) value += read_node(it); - } - for (int i = 0; i < meta_count; i++) { + for (int i = 0; i < meta_count; i++) value += *it++; - } return value; } diff --git a/Day8/Day8B.cpp b/Day8/Day8B.cpp index b87caf1..0036b05 100644 --- a/Day8/Day8B.cpp +++ b/Day8/Day8B.cpp @@ -27,9 +27,8 @@ int read_node(std::vector::iterator &it) } std::vector children; - for (int i = 0; i < child_count; i++) { + for (int i = 0; i < child_count; i++) children.push_back(read_node(it)); - } for (int i = 0; i < meta_count; i++) { int index = *it++;