#include using namespace std; int main(){ float abc; cout << "Please enter a floating point number: "; cin >> abc; cout << "Your number is: " << abc << "\n"; float* pointerFloat = &abc; int fl = *(int*)&abc; //assuming sizeof(int) = sizeof(float) int binaryRepresentation[sizeof(float) * 8]; for (int i = 0; i < sizeof(float) * 8; ++i){ binaryRepresentation[i] = ((1 << i) & fl) != 0 ? 1 : 0; } cout << "Binary of " << abc << " = "; for (int i = sizeof(float) * 8 - 1; i >= 0; i--){ cout << binaryRepresentation[i] << ""; } cout << "\n"; return 0; }