When I run my program, I get these errors, even though I have I have added "#include %26lt;cmath%26gt;"!
Will anyone help me how to fix them, please!
thank you!
/usr/lib/gcc/i386-redhat-linux/4.1.1/.... no te: long double std::pow(long double, int)
/usr/lib/gcc/i386-redhat-linux/4.1.1/.... no te: float std::pow(float, int)
/usr/lib/gcc/i386-redhat-linux/4.1.1/.... no te: double std::pow(double, int)
Help with this c++ error?
The signature for pow() is:
double pow(double x, double y);
Change your second parameter from int to double. Changing your return variable to a double is also advisable.
.
Reply:Converting from float, double or long double to int sometimes causes problems. First I would suggest running the compiled program and see if it runs properly (in my experience, often the program will run just fine despite the compiler giving you a warning). If you're sure the program's behavior is actually bugged, then you'll have to find some way to convert between different variable types. Unfortunately I don't know exactly how this is done, I'm still a noob at C++.
Reply:#include%26lt;cmath%26gt;
//your function should be
{
double pow (double variable1, double variable2);
}
from
keng ping kong from www.iwohoo.com and www.pinkeikong.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment