ASCII To Decimal

This algorithm converts ASCII code to decimal numbers.



									/*****Please include following header files*****/
// string
/***********************************************/

/*****Please use following namespaces*****/
// std
/*****************************************/

static string ASCIIToDecimal(string str) {
	string dec = "";
	int strLen = str.length();

	for (int i = 0; i < strLen; ++i)
	{
		string cDec = to_string(str[i]);;
		int cDecLen = cDec.length();

		if (cDecLen < 3)
			for (size_t j = 0; j < (3 - cDecLen); j++)
				cDec = cDec.insert(0, "0");

		dec += cDec;
	}

	return dec;
}
								


Example

									string data = "Programming Algorithms";
string value = ASCIIToDecimal(data);
								


Output

									080114111103114097109109105110103032065108103111114105116104109115