need some help please

I input X,Y
and x^y where x=x*x*...x (y times)
so how i can find power in C++?
If y is of type int and y > 0 you can try:

1
2
3
long power = 1;
for (int i=0;i<y;i++)
   power *= x;


Or more generally, you can use the built in C++ function "pow". You will have to include math.h. The documentation of this function can be found at http://www.cplusplus.com/reference/cmath/pow/
Topic archived. No new replies allowed.