You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
951 B
C

#include <stdio.h>
#include "utility.h"
int main() {
char operator;
double firstOperand = 0;
double secondOperand = 0;
do {
printf("Enter An Operator (+, -, *, /):\nEnter 'e' To Exit:\n");
scanf(" %c", &operator);
if (operator == 'e') {
break;
}
getOperands(&firstOperand, &secondOperand);
switch (operator) {
case '+':
add(firstOperand, secondOperand);
break;
case '-':
subtract(firstOperand, secondOperand);
break;
case '*':
multiply(firstOperand, secondOperand);
break;
case '/':
divide(firstOperand, secondOperand);
break;
default:
printf("Uh Oh! Invalid Operator Entered! Please Try Again!\n\n");
}
} while (operator != 'e');
return 0;
}