Browse Source

Added validation check for operation id

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
ea99b984a7
  1. 6
      src/inputHandler.c
  2. 2
      src/inputHandler.h

6
src/inputHandler.c

@ -1,4 +1,5 @@
#include "inputHandler.h"
#include <string.h>
int getOperationId(char symbol) {
int id = 0;
@ -41,3 +42,8 @@ char getOperationSymbol(int id) {
}
return symbol;
}
int isOperationValid(int id) {
if(id < 0 || id > 7) return 0;
return 1;
}

2
src/inputHandler.h

@ -5,4 +5,6 @@ int getOperationId(char);
char getOperationSymbol(int);
int isOperationValid(int);
#endif //THEADMIRALS_INPUTHANDLER_H
Loading…
Cancel
Save