From 7e8decf5f970cf30e94b1f4e522555e69d53212c Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Thu, 8 Feb 2024 21:40:01 +0100 Subject: [PATCH] Implemented reverse operation method for symbols --- src/inputHandler.c | 26 +++++++++++++++++++++++++- src/inputHandler.h | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/inputHandler.c b/src/inputHandler.c index fc88238..2100476 100644 --- a/src/inputHandler.c +++ b/src/inputHandler.c @@ -19,4 +19,28 @@ int getOperationId(char symbol) { return 7; } return id; -} \ No newline at end of file +} + +char getOperationSymbol(int id) { + char symbol = ' '; + switch (id) { + case 1: + return '+'; + case 2: + return '-'; + case 3: + return '/'; + case 4: + return '*'; + case 5: + + return '^'; + case 6: + return '%'; + + case 7: + + return '!'; + } + return symbol; +} diff --git a/src/inputHandler.h b/src/inputHandler.h index 1014f4d..98f1421 100644 --- a/src/inputHandler.h +++ b/src/inputHandler.h @@ -3,4 +3,6 @@ int getOperationId(char); +char getOperationSymbol(int); + #endif //THEADMIRALS_INPUTHANDLER_H