|
|
@ -1,10 +1,10 @@ |
|
|
|
// scientificMode |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <math.h> |
|
|
|
#include "taschenrechner.h" |
|
|
|
#include <math.h> |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
int scientificMode(){ |
|
|
|
int scientificMode() { |
|
|
|
|
|
|
|
double num, result; |
|
|
|
|
|
|
@ -20,7 +20,7 @@ int scientificMode(){ |
|
|
|
printf("4: Trigonometric\n"); |
|
|
|
scanf("%d", &choice); // user choice |
|
|
|
|
|
|
|
switch(choice) { |
|
|
|
switch (choice) { |
|
|
|
|
|
|
|
case 1: // Square root |
|
|
|
result = squareRootFunction(num); |
|
|
@ -35,13 +35,35 @@ int scientificMode(){ |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: // Trigonometric |
|
|
|
result = sineFunction(num); |
|
|
|
printf("Trigonometric functions:\n"); |
|
|
|
printf("5: Sine\n"); |
|
|
|
printf("6: Cosine\n"); |
|
|
|
printf("7: Tangent\n"); |
|
|
|
int trigChoice; |
|
|
|
scanf("%d", &trigChoice); |
|
|
|
|
|
|
|
switch (trigChoice) { |
|
|
|
case 5: // Sine |
|
|
|
result = sin(num); |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: // Cosine |
|
|
|
result = cos(num); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: // Tangent |
|
|
|
result = tan(num); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
printf("Invalid choice. Please try again.\n"); |
|
|
|
printf("Invalid trigonometric function choice.\n"); |
|
|
|
return -1; // Return an error code to indicate failure |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
printf("Invalid choice. Please try again.\n"); |
|
|
|
return -1; // Return an error code to indicate failure |
|
|
|
} |
|
|
|
|
|
|
|
printf("Result: %lf\n", result); |
|
|
|