decimal to hex cpp

C++
// Pretty stright forward
//  takes in input
//  outputs it in hex

#include <iostream>
using namespace std;

int main(){
        float i;
        cout << "What is the number?: ";
        cin  >> i;

        int* q = (int*)&i;
        cout << hex << *q << endl;

        return 0;
}
Source

Also in C++: