Decimal conversions to base numbers 2-16 (Binary through Hexadecimal)

前端 未结 6 1495
夕颜
夕颜 2021-01-16 15:03

Hey i\'m writing a program that converts decimal numbers into any base unit from binary to hexadecimal (2,3,4,....,15,16). This is what I have so far, running any number fro

6条回答
  •  花落未央
    2021-01-16 15:38

    This is weird, you return 0, which means "everything went fine" when there is an error, and you won't return anything otherwise. Plus yea, you meant || not | You didn't initialize your z variable, it could never enter the loop if it is 0, and even worse, you are never affection new value to z, so if it is not 0, it will never be and you are in an infinite loop

提交回复
热议问题