Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- union Repr {
- float f;
- char b[sizeof(float)];
- };
- void printfloat(){
- float f;
- cin >> f;
- cout.setf( ios::hex, ios::basefield );
- Repr rep;
- rep.f = f;
- cout<< short(rep.b[0])<<" "<< short(rep.b[1])<<" "<< short(rep.b[2])<<" "<< short(rep.b[3])<<endl;
- }
- int main()
- {
- int n;
- for(cin>>n; n>0; --n)
- printfloat();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement