Error: expression must have integer or unscoped enum type
I want to split the input integer into individual characters, but this error occurs when I use the pow() function. I want to know why the error is reported, and how to solve it.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int input, onecopy, twocopy;
cin >> input;
onecopy = input;
twocopy = input;
int n = 0;
int length = 0;
/* 记录数字长度n */
do
{
n++;
onecopy = onecopy / 10;
} while (!(onecopy / 10 == 0));
length = n + 1;
/* 拆数 */
int num[length];
int s = n;
for (int i = length - 1; i = 1; i--)
{
num[i] = twocopy % pow(10,s) ;
twocopy = twocopy / 10;
s--;
}
for (int i = 0; i < n; i++)
{
cout << num[i];
}
}