diff --git a/src/main/c/scientificMode.c b/src/main/c/scientificMode.c index 3e025f8..09fbc19 100644 --- a/src/main/c/scientificMode.c +++ b/src/main/c/scientificMode.c @@ -4,6 +4,19 @@ #include #include "taschenrechner.h" +// Choice for ScientificMode +int getScientificModeChoice() { + int choice; + printf("Scientific mode Options:\n"); + printf("1: Square root\n"); + printf("2: Exponential\n"); + printf("3: Logarithm\n"); + printf("4: Trigonometric\n"); + printf("0: Exit\n"); + scanf("%d", &choice); + return choice; +} + // Choice for Logarithm int getLogarithmChoice() { int logChoice; @@ -16,6 +29,7 @@ int getLogarithmChoice() { return logChoice; } +// Choice for Trigonomtri int getTrigonometricChoice() { int trigChoice; printf("Trigonometric functions:\n"); @@ -99,13 +113,7 @@ int scientificMode(){ printf("Enter a number: "); scanf("%lf", &num); // scan the number from the user - printf("Scientific mode Options:\n"); - printf("1: Square root\n"); - printf("2: Exponential\n"); - printf("3: Logarithm\n"); - printf("4: Trigonometric\n"); - printf("0: Exit\n"); - scanf("%d", &choice); // user choice + choice = getScientificModeChoice(); int logChoice, trigChoice; // Move the initialization outside the loops