Browse Source

Added number size check in input handler

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
5e21520280
  1. 8
      src/inputHandler.c
  2. 2
      src/inputHandler.h

8
src/inputHandler.c

@ -1,5 +1,5 @@
#include "inputHandler.h" #include "inputHandler.h"
#include <string.h>
#include <stdio.h>
// return operation id for a specific symbol // return operation id for a specific symbol
int getOperationIdBySymbol(char symbol) { int getOperationIdBySymbol(char symbol) {
@ -49,4 +49,10 @@ char getOperationSymbolById(int id) {
int isOperationIdValid(int id) { int isOperationIdValid(int id) {
if(id < 0 || id > 7) return 0; if(id < 0 || id > 7) return 0;
return 1; return 1;
}
int isNumberTooBig(int number) {
if(number < 200) return 0;
printf("Diese Nummer ist zu groß");
return 1;
} }

2
src/inputHandler.h

@ -7,4 +7,6 @@ char getOperationSymbolById(int);
int isOperationIdValid(int); int isOperationIdValid(int);
int isNumberTooBig(int);
#endif //THEADMIRALS_INPUTHANDLER_H #endif //THEADMIRALS_INPUTHANDLER_H
Loading…
Cancel
Save