Browse Source

refactoring: Extracted the trigonometric options from the executeTrigonometricFunction and move them into getTrigonometricChoice

remotes/origin/kabrel
fdai7782 11 months ago
parent
commit
98e8d6af3d
  1. 19
      src/main/c/scientificMode.c

19
src/main/c/scientificMode.c

@ -16,6 +16,17 @@ int getLogarithmChoice() {
return logChoice; return logChoice;
} }
int getTrigonometricChoice() {
int trigChoice;
printf("Trigonometric functions:\n");
printf("1: Sine\n");
printf("2: Cosine\n");
printf("3: Tangent\n");
printf("0: Exit Trigonometric Menu\n");
scanf("%d", &trigChoice);
return trigChoice;
}
// Logarithm // Logarithm
void executeLogarithmFunction(double num) { void executeLogarithmFunction(double num) {
@ -52,12 +63,8 @@ void executeTrigonometricFunction(double num) {
int trigChoice; int trigChoice;
do { do {
printf("Trigonometric functions:\n");
printf("1: Sine\n");
printf("2: Cosine\n");
printf("3: Tangent\n");
printf("0: Exit Trigonometric Menu\n");
scanf("%d", &trigChoice);
trigChoice = getTrigonometricChoice();
switch (trigChoice) { switch (trigChoice) {
case 1: // Sine case 1: // Sine

Loading…
Cancel
Save