I'm working on a problem to balance a checkbook. I've been struggling with it so I split it up into its components. I first made an array to store withdrawals. When I ran this program, everything ran fine. Now I'm trying to create a second array to store deposits. I can't get it to display properly.
First off it doesnt look like you are using a IDE cause when i copyed and pastes your code i got a few compiler errors for in lines 8 and 9 your code is:
double with = 0;
double dep = 0;
now the problem is not that you declared then double but that you ask for a whole number question...what if user entered 2.5....YOU CAN'T HAVE HALF AN ARRAY. so those need to be int.
Also your problem is on line 26 for (int j=0; i<dep; j++)
now first off the declared variable in this loop is j but your checker is i?and to further the destruction your last loop is for (int i=0; i<with; i++)
so if i had to guess when you run it is using the last i but you cant use the i in THAT scope.
And also you need to use the delete keyword to delete the memory you allocated in new.....so write
Im sorry if i was mean but i just told it how it was...also some advice would be to get you a compiler....it makes things 100 times easier!
Okay well I have this program about done, but I am reaching one final roadblock.
I need to display the beginning balance, the ending balance AND the balance after each deposit/withdrawal.
I have the beginning balance and ending balance, but I'm not sure what approach to take for the balance after each transaction.
Right now, I did this:
1 2 3 4 5 6
double *newBala = newdouble[with];
for (i=0; i<with; i++)
newBala[i] = begBal - wAmt[i];
The problem with this is that for each transaction it only shows the beginning balance minus the withdrawal.. not minus the cumulative total of the withdrawals (and same situation for the deposits). How do I get the withdrawals to change the balance after each transaction?