|
@ -13,13 +13,16 @@ double permutation(int n, int r); |
|
|
double combination(int n, int r); |
|
|
double combination(int n, int r); |
|
|
double pow(double num1, double num2); |
|
|
double pow(double num1, double num2); |
|
|
int mod(int num1,int num2); |
|
|
int mod(int num1,int num2); |
|
|
double log(num1); |
|
|
|
|
|
|
|
|
double log(double num1); |
|
|
double sqrt(double num1); |
|
|
double sqrt(double num1); |
|
|
double cbrt(num1); |
|
|
|
|
|
|
|
|
double cbrt(double num1); |
|
|
int multiply (int num1,int num2); |
|
|
int multiply (int num1,int num2); |
|
|
double divide (double num1, double num2); |
|
|
double divide (double num1, double num2); |
|
|
int add (int num1, int num2); |
|
|
int add (int num1, int num2); |
|
|
int subtract(int num1, int num2); |
|
|
int subtract(int num1, int num2); |
|
|
|
|
|
double exp(double num1); |
|
|
|
|
|
double ceil(double num1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int calculator() { |
|
|
int calculator() { |
|
|
int choice; |
|
|
int choice; |
|
@ -79,7 +82,10 @@ int subtract(int num1, int num2); |
|
|
printf("17. Tangent\n"); |
|
|
printf("17. Tangent\n"); |
|
|
printf("18. Permutation\n"); |
|
|
printf("18. Permutation\n"); |
|
|
printf("19. Combination\n"); |
|
|
printf("19. Combination\n"); |
|
|
printf("20. Exit\n"); |
|
|
|
|
|
|
|
|
printf("20. Ceil\n"); |
|
|
|
|
|
printf("21. Exponent\n"); |
|
|
|
|
|
// |
|
|
|
|
|
printf("21. Exit\n"); |
|
|
} |
|
|
} |
|
|
double performOperation(int choice, double num1, double num2) { |
|
|
double performOperation(int choice, double num1, double num2) { |
|
|
switch (choice) { |
|
|
switch (choice) { |
|
@ -122,6 +128,10 @@ int subtract(int num1, int num2); |
|
|
return permutation((int)num1, (int)num2); |
|
|
return permutation((int)num1, (int)num2); |
|
|
case 19: |
|
|
case 19: |
|
|
return combination((int)num1, (int)num2); |
|
|
return combination((int)num1, (int)num2); |
|
|
|
|
|
case 20: |
|
|
|
|
|
return 0; ceil(num1); |
|
|
|
|
|
case 21: |
|
|
|
|
|
return 0; exp(num1); |
|
|
default: |
|
|
default: |
|
|
return 0.0; |
|
|
return 0.0; |
|
|
} |
|
|
} |
|
@ -197,3 +207,11 @@ int subtract(int num1, int num2){ |
|
|
int subtraction = num1 - num2; |
|
|
int subtraction = num1 - num2; |
|
|
return subtraction; |
|
|
return subtraction; |
|
|
} |
|
|
} |
|
|
|
|
|
double exp(double num1){ |
|
|
|
|
|
double result = num1; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
double ceil(double num1){ |
|
|
|
|
|
double result = num1; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |