C++ examples for Function:Math Function
Use pow function from cmath header
#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; }