C++ pow() function

Description

C++ pow() function

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()// w w w.  ja  va 2s.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;
}



PreviousNext

Related