From 57b66f23b200e083a8a945e7fb6b970b8eef4b7c Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Thu, 8 Feb 2024 21:34:16 +0100 Subject: [PATCH] Added input handler --- src/inputHandler.c | 14 ++++++++++++++ src/inputHandler.h | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 src/inputHandler.c create mode 100644 src/inputHandler.h diff --git a/src/inputHandler.c b/src/inputHandler.c new file mode 100644 index 0000000..da56212 --- /dev/null +++ b/src/inputHandler.c @@ -0,0 +1,14 @@ +#include "inputHandler.h" + +int getOperationId(char symbol) { + int id = 0; + switch (symbol) { + case '+': + return 1; + case '-': + return 2; + case '*': + return 3; + } + return id; +} \ No newline at end of file diff --git a/src/inputHandler.h b/src/inputHandler.h new file mode 100644 index 0000000..1014f4d --- /dev/null +++ b/src/inputHandler.h @@ -0,0 +1,6 @@ +#ifndef THEADMIRALS_INPUTHANDLER_H +#define THEADMIRALS_INPUTHANDLER_H + +int getOperationId(char); + +#endif //THEADMIRALS_INPUTHANDLER_H