i would like to use only certain functions from math.h (WITHOUT including the entire library)
for example, i need to use "sqrt" and "exp", but i have variables named "y1" (and possibly others) which conflict with definitions in math.h
how can i use only certain functions from a library like that?
i tried
#define sqrt cmath::sqrt
but that did not work, i have seen something like that before with
#define cout std::cout
i think, so i thought it might work.
any ideas?
Put your code in your own namespace. By using namespace operator (::) you can distinguish variables with the same name (and which are in the same scope).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With