Hello, I need some advice on how this function outputs the left zeros so everything will be even at 16 bits
string conv (int num, int base) {
if (num == 0)
return "0000000000000000";
char NUMS[] = "0123456789ABCDEF";
string result = "";
do {
result.push_back (NUMS[num % base]);
num /= base;
} while (num != 0);
return string (result.rbegin(), result.rend());
}
Current Output:
100111110101
GOAL:
0000100111110101
Thanks in advance!