Any idea for the code for my getDigit function? I have to add on one digit at a time while in my loop. Dont know how to pick off one digit at a time. Is the function prototype correct so far?
int convertToBase10 (string number, int base)
{
int ans = 0;
int x = base;
int pos = 0;
for (unsignedint k = 0; k < number.length(); k++)
{
ans = (ans * x) + getDigit(number,pos++);
}
return ans;
}
int getDigit (string number, int position)
{
return ;
}