- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements