Exponentiation with C++!!??

abdeloihab Posted messages 80 Status Member -  
 Xx_pussy_slayer_kevin_maltais_xX -
Good evening
I don't know how to do x to the power of y in C++
I tried x**y but that doesn't work!!!
x^y doesn't work!!!
If anyone can help me please
thank you in advance, I am working on DEV C++
have a good evening

5 answers

  1. Luffy =) Posted messages 366 Status Member 110
     
    Hi!

    You need to use the pow() function:

    int i = pow(x, 2);

    to get x to the power of 2. The function is declared in math.h

    --
    The Parisien, it's better to have it in newspaper!!! :-P
    35
    1. Xx_pussy_slayer_kevin_maltais_xX
       
      thank you <3
      0