From 7a88cae1230b61928fe1601be2e74e2a2495cf28 Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Thu, 1 Feb 2024 14:11:00 +0000 Subject: [PATCH] Added scientificMode function with user input (no functionality yet) --- src/main/c/main_taschenrechner.c | 46 ++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index c64ab30..526d9e9 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -1,6 +1,7 @@ #include -// #include +#include #include +#include #include "taschenrechner.h" @@ -21,6 +22,48 @@ int divide(int a, int b) { return a / b; } +// scientificmode + +int scientificmode(){ + + double num, result; + + 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"); + scanf("%d", &choice); // user choice + + switch(choice) { + + case 1: // Square root + break; + + case 2: // Exponential + break; + + case 3: // Logarithm + break; + + case 4: // Trigonomertic + break; + + default: printf("Invalid choice. Please try again.\n"); + + } + + return result; +} + + +// change mode int mode(int userChoice){ switch(userChoice) { @@ -51,7 +94,6 @@ int mode(int userChoice){ // display the mode options: - int displayMenu(){ printf("\nCalculator Modes: \n");