Hi
I can't add to the same variable !!
Code:
unsigned long int Convert(char input[], int base)
{
unsigned long int value;
int i;
int n;
n = 0;
value = 0;
for(i=strlen(input)-1;i>=0;i--)
{
switch(input[i])
{
case 0:
value =+ pow(base,n)*0;
break;
case 1:
value =+ pow(base,n)*1;
break;
}
n++;
}
return value;
}
the result of this binary input --> 101 is
case 1:
value=1
i= 2
n= 0
case 0:
value=0
i= 0
n= 2
case 1:
value=4
i= 0
n= 1
final answer = 4 ------ where final answer should be 5
it's not adding to value... it's just displaying the final digit calculation
plz help.. I need to fix that in less than an hour..