I'm wondering if there is a way to represent a float using a char in C++?
For example:
int main()
{
float test = 4.7567;
char result = charRepresentation(test);
return 0;
}
I read that probably using bitset I can do it but I'm not pretty sure.
Let's suppose that my float variable is 01001010 01001010 01001010 01001010 in binary.
If I want a char array of 4 elements, the first element will be 01001010, the second: 01001010 and so on.
Can I represent the float variable in a char array of 4 elements?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…