|
|
@ -1,6 +1,7 @@ |
|
|
|
#include <stdio.h> |
|
|
|
// #include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
#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"); |
|
|
|