To save the transaction you are almost there.
int bal = 0; /* initialize balance to zero */
instead of bal = 0 + credit; replace for bal = bal + credit; or bal += credit; which is a shortcut.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218