The code below is the code I used last semster to turn decimal format intergers into hex, now is there a way I can reverse this function, and have it turn hex into dec.
Also the reason it is in a function format is we were studying funtions at the time of the assignment.
void displayHex(int pval)
{
int idiv,irmdr;
irmdr=pval%16;
idiv = pval/16;
if (idiv>0) displayHex(idiv);
if (irmdr<=9)
cout<<irmdr;
else if (irmdr==10)
cout<<'A';
else if (irmdr==11)
cout<<'B';
else if (irmdr==12)
cout<<'C';
else if (irmdr==13)
cout<<'D';
else if (irmdr==14)
cout<<'E';
else if (irmdr==15)
cout<<'F';
return;
}