My C++ program takes in three integer inputs and does some computations including division. At first, the end result was not a decimal. After searching a little on Stack Overflow (Dividing two integers to produce a float result), I found out that I'm supposed to add a (float), like this:
int a;
int b;
float c;
a = 5;
b = 2;
c = (float)a / b;
So I tried that but I ended up with my result being -nan(ind). First off, what does that mean? And second, how do I make my program work?
Here is the math I am trying to do in my program by the way.
int v;
int e;
int a;
float r;
r = ((float)e - v) / ((float)a / 1000);
Edit: Sorry, my mistake. I meant to type 1000 in the second example, not c.