
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
exp() function C++
The C / C++ library function double exp(double x) returns the value of e raised to the xth power. Following is the declaration for exp() function.
double exp(double x)
The parameter is a floating point value. And this function returns the exponential value of x.
Example
#include <iostream> #include <cmath> using namespace std; int main () { double x = 0; cout << "The exponential value of " << x << " is " << exp(x) << endl; cout << "The exponential value of " << x+1 << " is " << exp(x+1) << endl; cout << "The exponential value of " << x+2 << " is " << exp(x+2) << endl; return(0); }
Output
The exponential value of 0 is 1 The exponential value of 1 is 2.71828 The exponential value of 2 is 7.38906
- Related Articles
- PHP exp() Function
- exp() function for complex number in C++
- exp() function in PHP
- Function pointer to member function in C++
- iswblank() function in C/C++
- iswpunct() function in C/C++
- strchr() function in C/C++
- strtod() function in C/C++
- memmove() function in C/C++
- memcpy() function in C/C++
- atexit() function in C/C++
- raise() function in C/C++
- mbrlen() function in C/C++
- strftime() function in C/C++
- iswlower() function in C/C++

Advertisements