hello, im a starter in C++, for my assignment i have encountered the following warning which stops me from compiling, can any1 help please?
any suggestion would be greatly appreciated.
thanks alot
----> int nbsec = ((s3 / caloriesstep) / s4) * s5 ; <---
[Warning] converting to `int' from `float'
thanks!
li
At least one of the values s3, s4, s5 and/or caloriesstep has type float. Therefore
the type of the result of the expression is float. You want to assign that value to
nbsec which is an int. You'll lose 'precision' when you do that. Explicitly cast
the value back to type int to keep the compiler from warning you about it:
-
int nbsec = (int)(((s3 / caloriesstep) / s4) * s5) ;
-
kind regards,
Jos