I have two variable, count and totalcount, both are integer
My result is declared as float,
When I perform
result = count/totalcount;
it did not return a float as it should be.
Instead, it return 0 (eg 5/25)
How can I convert it to float?
Matthew Watson wrote: That won't work Rizawan...
totalCount/count will still be calculated in integer precision.
The correct answer is:
float result = count / (float)totalCount;
You are right I just took the quesiton wrong as you can assume from my answer above.
Rizwan aka RizwanSharp