## convert integer to any base C++

this function is capable of converting integers to any base format 2-16. this includes binary, octal, and hexadecimal. adding larger bases is as simple as lengthening the alpha string. //this recursive base converter is valid for base 2~16 void toBase(int num, int base) { string alpha="0123456789ABCDEF"; if (n > 0) { toBase(num/base,base); cout << alpha[num%base]; } }