|
|
@ -4,6 +4,7 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
// checking integer input as operation id |
|
|
|
bool checkOperationInput(int input) { |
|
|
|
switch (input) { |
|
|
|
case 4: case 3: case 2: case 1: |
|
|
@ -12,9 +13,12 @@ bool checkOperationInput(int input) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// full input process |
|
|
|
int* evaluateInput(char* input, int operation) { |
|
|
|
// check if formatting is correct |
|
|
|
if(!containsTwoNumbers(input)) return NULL; |
|
|
|
int firstNumber = extractFirstNumber(input); |
|
|
|
// origin string "input" has been edited |
|
|
|
int secondNumber = atoi(input); |
|
|
|
int* result = malloc(sizeof(int)); |
|
|
|
switch (operation) { |
|
|
|