From 1ef26654185b3439439b86952fd999a8580926cd Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 Apr 2026 00:55:55 +0300 Subject: [PATCH] Properly handled a case when addition was wrongly assumed --- input_resolver.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/input_resolver.cpp b/input_resolver.cpp index b95e481..05282da 100644 --- a/input_resolver.cpp +++ b/input_resolver.cpp @@ -71,7 +71,7 @@ Command resolveCommand() bool shouldQuit = token.find("q") != token.npos; bool shouldPrint = token.find("p") != token.npos; - char operation; + char operation = 0; for (const char c: token) { @@ -80,10 +80,11 @@ Command resolveCommand() { operation = c; } - else - { - operation = '+'; - } + } + + if (operation == 0) + { + operation = '+'; } return {shouldQuit, operation, validation_result.next_arg(), shouldPrint};