The values of a text 0 ('0') and text 1 ('1') are not the same as the values 0 and 1. As a matter of fact, the value 0 ('\0' or nul) is the sign of the end of a string.
You also have syntax errors. It's "+=", not "=+". You have so many errors that it's a wonder you got the program to run. Are you sure that you reproduced it correctly in the post? Make sure you have all errors and warnings enabled, and make a trip back to your books.
Also, make sure that the term, 'base', is not confusing you. For "pow", it's not the numeric base, it's the number to be raised to the exponent (the second argument).