Browse Source

Implement basic scientific calculator functions.

remotes/origin/kabrel
fdai7782 11 months ago
parent
commit
eb61b94c13
  1. 29
      src/main/c/scientificMode.c

29
src/main/c/scientificMode.c

@ -4,7 +4,6 @@
#include <math.h>
#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: // Trigonomertic
break;
case 4: // Trigonometric
result = sineFunction(num);
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;
}
Loading…
Cancel
Save