Armstrong -Zahl in CPP

// armstrong or not

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int num, temp, i, j, rem, sum=0, power=0;

    cout<< "Enter the number: ";
    cin>> num;

    temp = num;

    for(i=1; temp!=0; i++)
    {
        rem = temp % 10;
        for(j=0; j<10;j++)
        {
            if (rem == j)
                power++;
        }
        temp = temp / 10;
    }

    temp = num;

    for(i=1; temp!=0; i++)
    {
        rem = temp % 10;
        sum = sum + pow(rem, power);
        temp = temp / 10;
    }


    if(sum == num)
        cout<< "armstrong" ;
    else
        cout<< "Not armstrong";

    return 0;
}
Sleep deprived