+ 1

¿Function "Pow" en C++

how use function pow in c++ for obtain a result of Whole base and exponent with fraction

24th Jul 2017, 12:02 PM
Xavier Lopez
Xavier Lopez - avatar
5 odpowiedzi
+ 2
Tú habla Espanol (Spanish )? In c: pow(x,y)=x^y pow(3,2) = 3^2 = 9 (basic maths) for 3^(2/5) convert 2/5 into decimals ie 0.4 then find pow(3,0.4). This works for fraction exponent.
7th Nov 2017, 6:37 PM
Jaya Goswami
+ 3
pow function comes from <cmath> It is used as :- pow(num,exp); here num is the number and the exp is the exponent for that for example , pow(2,10) It will return 1024 . If you want the result in fraction then try storing numerator and denominator differently . For example :- int num=6; int den=4, res; int resn=pow(num,4); int resd=pow(den,2); cout<<"\n The result is : "<<resn<<"/"<<resd;; here num is the numerator and den is the denominator , resn is the result for numerator and resd is the result for denominator . These can take any value as you want , I just gave the sample for it. If you still don't understand then I can make a code for you .
24th Jul 2017, 1:09 PM
RZK 022
RZK 022 - avatar
+ 2
Bienvenido... 😁
7th Nov 2017, 7:49 PM
Jaya Goswami
+ 1
thank you ( no speak english) xD but very much thanks.
24th Jul 2017, 1:16 PM
Xavier Lopez
Xavier Lopez - avatar
+ 1
Si, hablo español. Gracias por responder =D
7th Nov 2017, 7:46 PM
Xavier Lopez
Xavier Lopez - avatar