|
@ -2,6 +2,8 @@ |
|
|
#include <libqalculate/qalculate.h>
|
|
|
#include <libqalculate/qalculate.h>
|
|
|
#include <string>
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
|
|
EvaluationOptions user_evaluation_options = default_evaluation_options; |
|
|
|
|
|
|
|
|
const char* qalculate(const char* input, bool exact_mode) { |
|
|
const char* qalculate(const char* input, bool exact_mode) { |
|
|
Calculator* c = new Calculator(); |
|
|
Calculator* c = new Calculator(); |
|
|
c->loadExchangeRates(); |
|
|
c->loadExchangeRates(); |
|
@ -10,11 +12,11 @@ const char* qalculate(const char* input, bool exact_mode) { |
|
|
std::string Input = input; |
|
|
std::string Input = input; |
|
|
std::string Output; |
|
|
std::string Output; |
|
|
if (exact_mode) { |
|
|
if (exact_mode) { |
|
|
default_user_evaluation_options.approximation = APPROXIMATION_EXACT; |
|
|
|
|
|
|
|
|
user_evaluation_options.approximation = APPROXIMATION_EXACT; |
|
|
} else { |
|
|
} else { |
|
|
default_user_evaluation_options.approximation = APPROXIMATION_APPROXIMATE; |
|
|
|
|
|
|
|
|
user_evaluation_options.approximation = APPROXIMATION_APPROXIMATE; |
|
|
} |
|
|
} |
|
|
Output = c->calculateAndPrint(Input,2000,default_user_evaluation_options); |
|
|
|
|
|
|
|
|
Output = c->calculateAndPrint(Input,2000,user_evaluation_options); |
|
|
delete c; |
|
|
delete c; |
|
|
char * output = new char [Output.length()+1]; |
|
|
char * output = new char [Output.length()+1]; |
|
|
Output.copy(output,Output.length()); |
|
|
Output.copy(output,Output.length()); |
|
|