decimal to hexadecimal c++ program code example
Example 1: int to hexadecimal in c++
#include <sstream>
std::stringstream sstream;
sstream << std::hex << my_integer;
std::string result = sstream.str();
Example 2: decimal to hex cpp
// 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;
}