Browse Source

Expanded main function with operation handler processing methods

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
5a164c3660
  1. 13
      src/main.c

13
src/main.c

@ -14,4 +14,17 @@ int main() {
} }
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)) {
buffer[strcspn(buffer, "\n")] = '\0';
if (strlen(buffer) > 0) {
break;
}
}
int* result = evaluateInput(buffer, input);
if(result == NULL) {
printf("\nInvalid formatting. Two numbers need to be separated by a space\n");
return 0;
}
printf("\nResult: %d", *result);
} }
Loading…
Cancel
Save