If its not nth power of 2, break

Hello why doesnt the line with pow(k, 2) work: if its not nth power of 2, break...
it doesnt break?

for(int i=0; a<100; i++){
array[i]=a;
a=2*a; }
for(int j=0; j<100; j++){
cout<<array[j] << ", ";
for(int k=2; k<100; k++){
if (array [j]!=pow(k,2)) break; //doesnt work
}
The break; will break out of the inner loop (for(int k...). The outer loop (for(int j...) will continue to run.
1. make sure you have inserted math header file
2. pow doesnt work for int variables,try declaring k as double or float)
Topic archived. No new replies allowed.