I want to save the value of a float variable named f
in the third element of an array named i
in a way that the floating point part isn't wiped (i.e. I don't want to save 1
instead of 1.5
). After that, complete the last line in a way that we see 1.5
in the output (don't use cout<<1.5;
or cout<<f;
or some similar tricks!)
float f=1.5;
int i[3];
i[2] = ... ;
cout<<... ;
Does anybody have any idea?