diff --git a/src/main/c/scientificMode.c b/src/main/c/scientificMode.c index 52ba133..b855139 100644 --- a/src/main/c/scientificMode.c +++ b/src/main/c/scientificMode.c @@ -4,7 +4,6 @@ #include #include "taschenrechner.h" - int scientificMode(){ double num, result; @@ -12,33 +11,39 @@ int scientificMode(){ int choice; printf("Enter a number: "); - scanf("%lf", &num); // scan the number from user - + printf("Scientific mode Options:\n"); - printf("1: Square root:\n"); - printf("2: Exponential:\n"); - printf("2: Logarithm:\n"); - printf("4: Trigonomertic"); + printf("1: Square root\n"); + printf("2: Exponential\n"); + printf("3: Logarithm\n"); + printf("4: Trigonometric\n"); scanf("%d", &choice); // user choice switch(choice) { case 1: // Square root - break; + result = squareRootFunction(num); + break; case 2: // Exponential - break; + result = exponentialFunction(num); + break; case 3: // Logarithm - break; + result = logarithmFunction(num); + break; + + case 4: // Trigonometric + result = sineFunction(num); + break; - case 4: // Trigonomertic - break; - - default: printf("Invalid choice. Please try again.\n"); + default: + printf("Invalid choice. Please try again.\n"); + return -1; // Return an error code to indicate failure } + printf("Result: %lf\n", result); return result; }