Browse Source

Added calculator modes functionality

remotes/origin/feature
fdai7782 11 months ago
parent
commit
0649393e93
  1. 28
      src/main/c/main_taschenrechner.c
  2. 2
      src/main/c/taschenrechner.h

28
src/main/c/main_taschenrechner.c

@ -20,3 +20,31 @@ int multiply(int a, int b) {
int divide(int a, int b) {
return a / b;
}
int mode(int userChoice){
switch(userChoice) {
case 1:return 1; // Basic mode
break;
case 2:return 2; // Scientific mode (Trigonomertic functions, Logarithm and exponential functions.)
break;
case 3:return 3; // Graph mode (Draw and visualize functions.)
break;
case 4:return 4; // Programming mode (Binary , octal and hexadecimal )
break;
case 5:return 5; // Unit converter mode (length, weight volume etc.)
break;
case 0: return 0; // printf("Exiting the calculator.\n");
break;
default: return -1; // printf("Invalid choice. Please try again.\n");
}
}

2
src/main/c/taschenrechner.h

@ -9,4 +9,6 @@ int multiply(int a, int b);
int divide(int a, int b);
int mode(int userChoice);
#endif // TASCHENRECHNER_H
Loading…
Cancel
Save