|
-
November 8th, 2009, 06:26 PM
#1
Power Funtion problem C++
Hi,
I am using a power funtion in my program and i am getting errors and apparently my program is not accepting the changes.
I am using the 'pow' function. the formulas i am writing are - Diameter = B Volume 1/3 and Pressure = Volume 1/ B
and i am using #include <cmath>
/*************************************…
** Diameter
**************************************…
float balloon: iameter()
{
return (B * (float) pow(Volume,(1/3))); // Calculating Diameter
}
/*************************************…
** Pressure
**************************************…
float balloon: ressure()
{
return ((float) pow(Volume,(1/B))); // Caluclating Pressure
}
the errors i am getting with this is -
\visual studio 2008\projects\prog8\code_2.cpp(71) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
\visual studio 2008\projects\prog8\code_2.cpp(81) : error C2666: 'pow' : 6 overloads have similar conversions
c:\program files\microsoft visual studio 9.0\vc\include\math.h(575): could be 'long double pow(long double,int)'
c:\program files\microsoft visual studio 9.0\vc\include\math.h(573): or 'long double pow(long double,long double)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(527): or 'float pow(float,int)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(525): or 'float pow(float,float)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(489): or 'double pow(double,int)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(123): or 'double pow(double,double)'
1> while trying to match the argument list '(float, double)'
1>Build log was saved at "file://c:\Users\Aman\Documents\Visual Studio 2008\Projects\Prog8\Debug\BuildLog.htm"
1>Prog8 - 1 error(s), 1 warning(s)
Would appreciate any help...
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|