>His notes said to format it like I had %.2f
Just for other people's reference, your instructor was talking about output with printf, not input with scanf. scanf doesn't use the precision modifier because there's really no point.
>I have figured it out!
Did you figure out the other two complaints about your broken code? They're both somewhat important because they make the entire program unpredictable. By the way:
>fflush (stdin);
Remove these entirely. There's no point in even attempting to "flush" stdin unless you're mixing input schemes that conflict, like scanf and getchar. Since scanf is smart enough to clean up after itself for most common usage, you're adding a broken construct for no reason. Rather than just throw fflush(stdin) after every request for input, why not try to learn why such a thing would be needed? That way you can learn that it's wrong, and ways to avoid the problem without using something that's wrong.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004