I'm start(really starting) an Assembly tool, at the time it only converts a decimal to a hexadecimal, but I want to remove the zeros from the result. Here is the code:
// HexConvert.cpp
#include <iostream>
using namespace std;
int main()
{
int decNumber;
while (true)
{
cout << "Enter the decimal number: ";
cin >> decNumber;
// Print hexadecimal with leading zeros
cout << "Hexadecimal: ";
for (int i = 2*sizeof(int) - 1; i >= 0; i--)
{
cout << "0123456789ABCDEF"[((decNumber >> i*4) & 0xF)];
}
cout << endl;
}
return 0;
}
How can I do this?