Stack around the variable 'total' is corrupted
Code:
//before this, i calculate the various taxes
float total[4]; //problem can be fixed by making this float total[5];, but then
//i have an empty slot. total[5].
float totrate;
int tothours;
for (x=0;x<5;x++) //problem here
{
total[x]=0;
for(y=0;y<size;y++) total[x]+=money[y][x];
}
//later on, I cout<< the various money variables, and I cout<<the total variables manually
//cout<<left<<setw(9)<<total[0].....<<setw(9)<<total[4]; Program ends here.
Here's a small snippet of code, that includes ONLY where I'm having trouble. If anyone wants, I can post the full code.
note:
money[y][x]: various taxes that were calculated earlier on. x represents tax type [ie. 0 is federal, 1 is social security, etc]. y corresponds with the person.
There are five taxes.
0=federal
1=ss
2=fica
3=health
4=health2
As it is right now, the program works 100%,except for the error at the end
Stack around the variable 'total' is corrupted