std::pow
is defined in cmath
, so you need to include cmath
:
#include <iostream>
#include <cmath> // <-- include cmath here
using namespace std;
int main()
{
int x;
cout << "How many rows would you like? " << endl;
cin >> x;
cout << endl;
cout << "Number| Power 1| Power 2| Power 3| Power 4| Power 5" << endl;
for (int j=0; j<=x; j++)
{
cout << j << "\t" << j << "\t" << pow(j,2) << "\t" << pow(j,3) <<
"\t" << pow(j,4) << "\t" << pow(j,5) << endl;
}
return 0;
}