Properly handled a case when addition was wrongly assumed

This commit is contained in:
2026-04-02 00:55:55 +03:00
parent 9c090bc317
commit 1ef2665418
+6 -5
View File
@@ -71,7 +71,7 @@ Command resolveCommand()
bool shouldQuit = token.find("q") != token.npos; bool shouldQuit = token.find("q") != token.npos;
bool shouldPrint = token.find("p") != token.npos; bool shouldPrint = token.find("p") != token.npos;
char operation; char operation = 0;
for (const char c: token) for (const char c: token)
{ {
@@ -80,10 +80,11 @@ Command resolveCommand()
{ {
operation = c; operation = c;
} }
else }
{
operation = '+'; if (operation == 0)
} {
operation = '+';
} }
return {shouldQuit, operation, validation_result.next_arg(), shouldPrint}; return {shouldQuit, operation, validation_result.next_arg(), shouldPrint};