I want to use math functions as pow and sqrt.
When i try to do that (including math.h) I get an error msg saying that these operator are double and i'm performing a calculation with integers
Any ideas?
This is a discussion on How do I use mathematical operators? within the C++ Programming forums, part of the General Programming Boards category; I want to use math functions as pow and sqrt. When i try to do that (including math.h) I get ...
I want to use math functions as pow and sqrt.
When i try to do that (including math.h) I get an error msg saying that these operator are double and i'm performing a calculation with integers
Any ideas?
Pana8hnaikos The Pride Of Greece
You could try following the advice of the errors. Either declare the variables that you want to use the math functions on as double, or cast the result of the functions to int, like so:
-PreludeCode:int x = 256, result; result = (int)sqrt(x);
My best code is written with the delete key.
Thx man
I used casting as
int x;
double approx_x;
approx_x=double(x);
Thanks![]()
Pana8hnaikos The Pride Of Greece