The index of your string bin goes from left to right. For example, if the string is "1000", then bin[0] is '1'. I'm not sure if you can just multiply bin[0] by a number, either. Maybe you have an overloaded operator to do so already. If not, you may need a function like atoi().
No comments:
Post a Comment