im writing a simple program that turns a decimal to hex. im only posting the piece of code where i have the problems
string hexnumeral (int d) {
int h,l;
string e,y,f;
if (d < 16)
return hexdigit (d);
else {
f = d / 16;
h = d % 16;
f += h;
y = hexdigit (h);}
if (h == 0)
return f += "0";
else
return f;
}
when is the number is under 16 everything is good. but if its 16 or over i get "0"
the hexdigit fuction is basically a list of
if h=1
return 1
if h==2
return 2
etc its quite long so i omitted it
jjust to make this clear im having the problem startign with the first else in the code