![]() |
| ||
| Printing gets me incorrecting answers This is the problem, when I run it, there are no errors. However when I check the reportfile, I end up with the wrong numbers from the calculations. The calculator: void AddDetailToAccumulators(float *totfedtax, float *totssitax, float *totstatetax,float *totrate, float *totreg, The printer file void Print_Summary_To_File(float totfedtax, float totssitax, float totstatetax,float totrate, float totreg, What was printed on reportfile: Quote:
|
| ||
| Re: Printing gets me incorrecting answers Well, you could look at the values in the debugger if you have one, or you could add additional print statements to better confirm the values. If you come to the conclusion that the values are correct then you have to chase back to where they came from to see where they were last correct. (This is why developing and testing iteratively makes so much sense, you only have to look at the new stuff if something stops working.) it almost doesn't make any sense to calculate the average as you go along (unless you need intermediate averages). In the AddDetailToAccumulators() you are dividing the total by MAX to generate the average. Are you always going to read MAX values? Secondarily, the AddDetailToAccumulators() adds to the totals...did you ensure that you initialized the totals to zero before you started? |
| ||
| Re: Printing gets me incorrecting answers I am posting this, absolutely not to find error in your code(coz its really hard to understant your code) but to tell you, how you can improve your coding style so that the error rate becomes less. You have been suggested to use struct in place of passing so many parameters to a function. Try to code simple so that others can understand your code easily. At least you do this, to make ur and our life easier. |
| All times are GMT -4. The time now is 3:15 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC