#include#include int main() { double x = 3.0; double result = std::exp(x); std::cout << "exp(" << x << ") = " << result << std::endl; return 0; }
exp(3) = 20.0855
#include#include int main() { double x = -2.0; double result = std::exp(x); std::cout << "exp(" << x << ") = " << result << std::endl; return 0; }
exp(-2) = 0.135335In both examples, the `std::exp` function is used with a single argument to calculate the exponential value of that argument. The first example uses a positive value, while the second example uses a negative value. Both examples utilize the cmath library and return values of type double.