I have been working on this code for a banking program I am trying put together. Trying to test my ability to grasp this stuff on my own. I am stuck on this part and maybe it is my non-math mind that is causing a block. Can someone help me understand where I put the if statement to denote that if the account is overdrawn it is charged an overdraft fee of $35. Even if you don't write it out in code and explaination would be phenomenal. I'm really lost on some of these rules.
Here is the code I have so far
#include <stdio.h>
Main ( )
{
int iSelection,iresponse,n,y;
float fwithamount,bal,fdepamount;
printf("Please enter amount of initial deposit.\n");
scanf("%f",&fdepamount);
bal=fdepamount;
while(iresponse != 1)
{
printf("\nWould you like to make another transaction?\n");
printf("\n1\tno\n");
printf("2\tyes\n");
printf("\nEnter your selection:\n ");
scanf("%d",&iresponse);
/* This Branch describes the program actions when the customer selects whether or not to perform an additional transaction. */
if(iresponse == 1)
{
printf("Your balance is $%.2f",bal);
break;
} //end if
if(iresponse == 2) {
printf("\n1\tDeposit Funds\n");
printf("2\tWithdraw Funds\n");
printf("\nEnter your selection: ");
scanf("%d",&iSelection);
} //end if
if (iSelection == 1) {
printf("\nEnter fund amount to deposit: ");
scanf("%f",&fdepamount);
printf("\nYour new balance is: $%.2f\n",bal+fdepamount);
bal=bal+fdepamount;
} //end if
if (iSelection == 2) {
printf("\nEnter fund amount to withdraw: ");
scanf("%f",&fwithamount);
printf("\nYour new balance is $%.2f\n",bal-fwithamount);
bal=bal-fwithamount;
} //end if
} //end while loop
getchar();
} //end main function