From b569180ebd4141c4b8302e21c34f90719cfb3da0 Mon Sep 17 00:00:00 2001 From: Sebastian Brosch Date: Fri, 1 Nov 2024 21:55:53 +0100 Subject: [PATCH] optimized variables --- VL03-03-01/main.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/VL03-03-01/main.cc b/VL03-03-01/main.cc index 74a9b3d..33758d2 100644 --- a/VL03-03-01/main.cc +++ b/VL03-03-01/main.cc @@ -32,12 +32,13 @@ void clear(std::vector &phonebook) { std::vector getPhonebookFromFile(std::string filename) { std::ifstream file(filename); - std::string line; - int rownumber = 0; std::vector phonebook; phonebook_entry* entry; if (file.is_open()) { + int rownumber = 0; + std::string line; + while (file >> line) { switch (rownumber % 3) { case 0: