Your problem is chartDisplay().
Having had to re-write the damn thing for my compiler not to flag up a hell of a lot of amount of warnings....
1. Prototype please
2. Check computeTax
do you really think that else if( 336550 >= a > 188450) is going to do what you think it's going to do? Try using the logical operators to make this more reader friendly.
After that within chartDisplay()
you ask for getIncome()
and in computeTax you also call for getIncome ....
These things aren't doing what you think they're doing.
Each time you call getIncome, you won't get the data out of the previous call, instead you'll be asked to enter new data.
...basically you're screwing with function calls a little too much.
--------------------------/rant
In main you will want an array of floats. You'll probably want to enumerate some names too...
So for...example/guide/though-provoke
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
array[6] = {}; //Empty array
enum chart_headings = { ActualOther, ActualTithing, ActualTax....}
//Input data into the array.
array[ ActualOther ] = getActualOther
array[ActualTithin] = getActualTithing
/*********************/
// Compute tithing can use that information...
computeTithing(array[Income]) //Remember it's been enumerated so this is effectively a number.
float computeTithing(float income_from_array)
{
float tithe;
float income = income_from_array;
tithe = income * 0.1;
return tithe
}
|
...To be honest I wouldn't even be using an array, I'd be using a struct.