|
@ -20,3 +20,31 @@ int multiply(int a, int b) { |
|
|
int divide(int a, int b) { |
|
|
int divide(int a, int b) { |
|
|
return a / 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"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |