[Solved] Convert Unsigned Long to an string in ascii [closed]


Sure – it’s trivial (sadly, I currently can’t compile the code so there are probably a couple of typos):

std::string convert(unsigned long value, unsigned long base) {
    std::string rc;
    do {
        rc.push_back("0123456789abcde"[value % base]);
    } while (base - 1? value /= base: value--);
    std::reverse(rc.begin(), rc.end());
    return rc;
}

4

solved Convert Unsigned Long to an string in ascii [closed]