Mega Code Archive

 
Categories / C++ / Data Type
 

Get the square root, power and log value of a double

#include <iostream> #include <cmath> using namespace std; int main() {  double number, dsqrt,dpow,dlog;  cout << "Please enter a number \n";  cin >> number;  dsqrt =sqrt(number);  dpow =pow(number,5);  dlog =log(number);  cout << " Math Example\n";  cout << " Square Root is " << dsqrt << "\n";  cout << " Raised to the fifth power is " << dpow << "\n";  cout << " Log is " << dlog << "\n";  return 0; }