I'm building a calculator application that will calculate the exact net pay after taxes. The problem I am having is that the program automatically rounds the values up.
I tried using setprecision, but it seems to only work when used in a cout or cin line. That would require user input, the values I need to apply setprecision on are determined by the program itself. For instance, if I place setprecision on line 42, which updates the variable 'federal', the compiler returns an error expecting a ';' prior to it. How can I set the precision of a variable without requiring user input.
To clarify, the only variables which the user enters are 'hours' and 'payrate'. The other variables are interacted with like the example below.
40 if ((gross >= 0) && (gross < 260))
41 {
42 federal = ((gross - 73) * .1);
43 }