Use pow function from cmath header - C++ Function

C++ examples for Function:Math Function

Description

Use pow function from cmath header

Demo Code

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()//  ww w . ja  v  a2  s  .c o  m
{
   int x, y;
   cout << "x value   y value\n" << "-------   --------\n";
   for (x = 2; x <= 6; x++)
   {
      y = 10 * pow(x,2.0) + 3 * x - 2;
      cout << setw(4) << x << setw(11) << y << endl;
   }
   return 0;
}

Result


Related Tutorials