C Error: declaration shadows a local variable — Won’t let me repeatedly replace the value of my float variable
Replace float cents = with cents = in your while loops. Currently you’re trying to declare a new variable cents which shadows the existing one. Technically this is valid C, perhaps your compiler (thankfully) has this warning set to an error? Note that you could optimise much of your logic to O(1) using integer division and careful checking with your debugger. Repeatedly subtracting from a value is … Read more