+ 1
ÂżFunction "Pow" en C++
how use function pow in c++ for obtain a result of Whole base and exponent with fraction
5 Answers
+ 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.
+ 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 .
+ 2
Bienvenido... đ
+ 1
thank you ( no speak english) xD
but very much thanks.
+ 1
Si, hablo español.
Gracias por responder =D