|
@ -6,12 +6,15 @@ char buffer[100]; |
|
|
|
|
|
|
|
|
int main() { |
|
|
int main() { |
|
|
printf("Please enter the id of a specific operation...\n1. addition\n2. subtraction\n3. multiplication\n4. division\n"); |
|
|
printf("Please enter the id of a specific operation...\n1. addition\n2. subtraction\n3. multiplication\n4. division\n"); |
|
|
|
|
|
|
|
|
int input; |
|
|
int input; |
|
|
scanf("%d", &input); |
|
|
scanf("%d", &input); |
|
|
|
|
|
|
|
|
if(!checkOperationInput(input)) { |
|
|
if(!checkOperationInput(input)) { |
|
|
printf("Invalid operation id\n"); |
|
|
printf("Invalid operation id\n"); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
printf("\nPlease enter the first and the second number separated by a space...\n"); |
|
|
printf("\nPlease enter the first and the second number separated by a space...\n"); |
|
|
|
|
|
|
|
|
while(fgets(buffer, 100, stdin)) { |
|
|
while(fgets(buffer, 100, stdin)) { |
|
@ -22,6 +25,7 @@ int main() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int* result = evaluateInput(buffer, input); |
|
|
int* result = evaluateInput(buffer, input); |
|
|
|
|
|
|
|
|
if(result == NULL) { |
|
|
if(result == NULL) { |
|
|
printf("\nInvalid formatting. Two numbers need to be separated by a space\n"); |
|
|
printf("\nInvalid formatting. Two numbers need to be separated by a space\n"); |
|
|
return 0; |
|
|
return 0; |
|
|