Say I have a double as follows:
double aDouble = 15.6;
and I want to convert it to three int's as follows:
int x = 1;
int y = 5;
int z = 6;
How would I go about doing this?
Since this looks like homework, I will give you 2 clues.
You should be able to work out the rest.
double aDouble = 15.6;
int tmp = aDouble*10;
int x, y, z;
x = tmp/100;
tmp -= x * 100;
y = tmp/10;
tmp -= y * 10;
z = tmp;