Decimal To ASCII
This algorithm converts decimal numbers to ASCII code.
/*****Please include following header files*****/
// string
/***********************************************/
/*****Please use following namespaces*****/
// std
/*****************************************/
static string DecimalToASCII(string dec) {
string ascii = "";
int decLen = dec.length();
for (int i = 0; i < decLen; i += 3)
{
ascii += (char)std::stoi(dec.substr(i, 3));
}
return ascii;
}
Example
string data = "080114111103114097109109105110103032065108103111114105116104109115";
string value = DecimalToASCII(data);
Output
Programming Algorithms