|
@ -24,6 +24,9 @@ double exp(double num1); |
|
|
double ceil(double num1); |
|
|
double ceil(double num1); |
|
|
double floor(double num1); |
|
|
double floor(double num1); |
|
|
double round(double num1); |
|
|
double round(double num1); |
|
|
|
|
|
double fmax(double num1,double num2); |
|
|
|
|
|
double log10(double num1); |
|
|
|
|
|
//double exp2(double num1); |
|
|
|
|
|
|
|
|
int calculator() { |
|
|
int calculator() { |
|
|
int choice; |
|
|
int choice; |
|
@ -87,8 +90,11 @@ double round(double num1); |
|
|
printf("21. Exponent\n"); |
|
|
printf("21. Exponent\n"); |
|
|
printf("22. Floor\n"); |
|
|
printf("22. Floor\n"); |
|
|
printf("23. Round\n"); |
|
|
printf("23. Round\n"); |
|
|
// |
|
|
|
|
|
printf("21. Exit\n"); |
|
|
|
|
|
|
|
|
printf("24. fmaximum"); |
|
|
|
|
|
printf("25. base 10 logarithm"); |
|
|
|
|
|
// printf("26. 2 raise to the power"); |
|
|
|
|
|
// printf("27 trunc"); |
|
|
|
|
|
printf("28. Exit\n"); |
|
|
} |
|
|
} |
|
|
double performOperation(int choice, double num1, double num2) { |
|
|
double performOperation(int choice, double num1, double num2) { |
|
|
switch (choice) { |
|
|
switch (choice) { |
|
@ -139,6 +145,14 @@ double round(double num1); |
|
|
return 0; floor(num1); |
|
|
return 0; floor(num1); |
|
|
case 23: |
|
|
case 23: |
|
|
return 0; round(num1); |
|
|
return 0; round(num1); |
|
|
|
|
|
case 24: |
|
|
|
|
|
return 0; fmax(num1,num2); |
|
|
|
|
|
case 25: |
|
|
|
|
|
return 0; log10(num1); |
|
|
|
|
|
// case 26: |
|
|
|
|
|
// return 0; exp2(num1); |
|
|
|
|
|
// case 27: |
|
|
|
|
|
// return 0; trunc(num1); |
|
|
default: |
|
|
default: |
|
|
return 0.0; |
|
|
return 0.0; |
|
|
} |
|
|
} |
|
@ -231,3 +245,21 @@ double round(double num1){ |
|
|
double result = num1; |
|
|
double result = num1; |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
double fmax(double num1 , double num2){ |
|
|
|
|
|
double maximum = fmax(num1,num2) ; |
|
|
|
|
|
return maximum; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double log10(double num1){ |
|
|
|
|
|
double result = num1; |
|
|
|
|
|
return result; |
|
|
|
|
|
}/* |
|
|
|
|
|
double log10(double num1){ |
|
|
|
|
|
double result = num1; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
double trunc(double num1){ |
|
|
|
|
|
double result = num1; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
*/ |