if (str[count]!="0")

Don't compare strings (or any other objects) with == and != as it is unlikely these do what you expect. Instead use the string method equals() which will do exactly what it...