I'm attempting another simple calculation program... a bank program to be specific. It asks how many deposits does the user want, user inputs x... program asks to input x amount of deposits. Same goes for withdraws.
What I can't figure out is that I want the program to display totals of a deposit. Here's what I have so far
So basically I have that... but after that, I want to be able to display something like:
printf ("\nPlease enter your beginnnng balance: $");
scanf ("%f", &beg_bal);
printf ("\nYour beginning balance is: $%-10.2f", beg_bal);
cur_bal = beg_bal;
printf ("\n\nHow many deposits will you be making? ");
scanf ("%d", &depamt);
for (index = 1; index <= depamt; index++)
printf ("\nPlease enter a deposit: $");
scanf ("%f", &deposit);
printf ("\nYou have deposited : $%6.2f", deposit);
printf ("\nYour current balance is: $%6.2f\n", cur_bal);
"You have made x deposits which totals $x.xx."
I'd do something like:
printf ("You have made %d deposits which totals $%f", depamt, ...);
But I've no idea what I can use for the "...". I'm guessing I can do some kind of a foruma for the for loop body but I've no idea what to do.
Since this is a for loop, it'd be dumb to include a float variable for each deposit... any way to accomplish this? Thanks.