#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uc.DefineConstant("pi = Atan(1) * 4"); // Original Cosine behavior with Radian cout << uc.EvalStr("Cos(pi)") << endl; cout << uc.EvalStr("Cos(180)") << endl; // Cos is renamed to CosR so that Cos can now be defined in Degree uc.ItemOf("Cos").Rename("CosR"); uc.DefineFunction("Cos(x) = CosR(x*pi/180)"); // Now Cos is in Degree cout << uc.EvalStr("Cos(pi)") << endl; cout << uc.EvalStr("Cos(180)") << endl; // This is the original function now named CosR cout << uc.EvalStr("CosR(pi)") << endl; cout << uc.EvalStr("CosR(180)") << endl; // Note: Some functions may be overloaded, such as the Cos function in // this example, which has a definition for Double and another for Complex. // This example renames only the Double precision version. // You can use NextOverload() and DataType() to pinpoint the one you want }