#include #include using namespace std; int main (int argc, char * const argv[]) { char szHexInput [9]; char szHexFixed [9]; stringstream ssHexInputFixed, ssByteBuffer, ssFinalHex; cout << "Please enter hex to be converted: 0x"; cin >> szHexInput; int nLength = strlen(szHexInput); for(int i = 0; i < (nLength + 1); i++) { ssByteBuffer << szHexFixed[nLength - i] << szHexFixed[nLength - (i - 1)]; ssFinalHex << ssByteBuffer.str().c_str(); ssByteBuffer.str(""); } cout << "Final Hex: " << ssFinalHex.str().c_str() << endl; return 0; }