|
@ -1,7 +1,8 @@ |
|
|
#include "inputHandler.h" |
|
|
#include "inputHandler.h" |
|
|
#include <string.h> |
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
int getOperationId(char symbol) { |
|
|
|
|
|
|
|
|
// return operation id for a specific symbol |
|
|
|
|
|
int getOperationIdBySymbol(char symbol) { |
|
|
int id = 0; |
|
|
int id = 0; |
|
|
switch (symbol) { |
|
|
switch (symbol) { |
|
|
case '+': |
|
|
case '+': |
|
@ -23,7 +24,7 @@ int getOperationId(char symbol) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// returns operation symbol for a specific operation id |
|
|
// returns operation symbol for a specific operation id |
|
|
char getOperationSymbol(int id) { |
|
|
|
|
|
|
|
|
char getOperationSymbolById(int id) { |
|
|
char symbol = ' '; |
|
|
char symbol = ' '; |
|
|
switch (id) { |
|
|
switch (id) { |
|
|
case 1: |
|
|
case 1: |
|
@ -45,7 +46,7 @@ char getOperationSymbol(int id) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Checking if operation id is available |
|
|
// Checking if operation id is available |
|
|
int isOperationValid(int id) { |
|
|
|
|
|
|
|
|
int isOperationIdValid(int id) { |
|
|
if(id < 0 || id > 7) return 0; |
|
|
if(id < 0 || id > 7) return 0; |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |