|
|
@ -13,6 +13,14 @@ int getIntegerInput(const char* prompt) { |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
// Display the diffrent operations and scan them |
|
|
|
char getOperatorInput() { |
|
|
|
char operator; |
|
|
|
printf("Enter operator (+, -, *, /): "); |
|
|
|
scanf(" %c", &operator); |
|
|
|
return operator; |
|
|
|
} |
|
|
|
|
|
|
|
// Calculation |
|
|
|
int performOperation(int num1, char operator, int num2) { |
|
|
|
switch (operator) { |
|
|
@ -40,10 +48,7 @@ void programmingMode() { |
|
|
|
char operator; |
|
|
|
|
|
|
|
num1 = getIntegerInput("Enter first integer: "); |
|
|
|
|
|
|
|
printf("Enter operator (+, -, *, /): "); |
|
|
|
scanf(" %c", &operator); |
|
|
|
|
|
|
|
operator = getOperatorInput(); |
|
|
|
num2 = getIntegerInput("Enter second integer: "); |
|
|
|
|
|
|
|
// Calculation + Display the result |
|
|
|