You're still not getting it...
Code:
#include <stdio.h>
#define interest = .02
int main ()
{
int date, choice, option1, option2;
double amt, balance= 2000.00;
do{
printf(" Welcome to Moon Trust Bank!\n\n");
printf(" Please Choose From The Following Options.\n\n");
printf(" 1) Deposit Funds (Credit Transaction)\n");
printf(" 2) Withdraw Funds ( Debit Transaction)\n");
printf(" 3) Print Statement of Account\n");
printf(" 4) Compute Interest and Exit the Program\n");
scanf("%d", &choice);
if (choice == 1){
printf("Your current balance is $%.2f.\n", balance);
printf("Please enter the date.\n");
scanf("%d", &date);
printf("Please enter the amount you wish to deposit into your account.\n");
scanf("%lf", &amt);
balance = balance + amt;
printf("Your current balance is $%.2f.\n\n", balance);
}
else if (choice == 2){
printf("Your current balance is $%.2f.\n", balance);
printf("Please enter the date.\n");
scanf("%d", &date);
printf("Please enter the amount you wish to withdraw from your account.\n");
scanf("%lf", &amt);
if (amt > balance){
printf(" Please enter a smaller amount, funds not sufficient!\n");
scanf("%lf", &amt);
}
balance = balance - amt;
printf("Your current balance is $%.2f.\n\n", balance);
}
else if (choice == 3){
printf("Your current balance is $%.2f.\n", balance);
printf("Please enter the date.\n");
scanf("%d\n\n", &date);
printf("So far this month:\n");
printf("Your current balance is $%.2f.\n", balance);
printf("Your total number of credit transactions are %d\n", option1);
printf("Your total number of debit transactions are %d\n", option2);
}
}
while (choice == 4)//here's your problem... does the while belong to the do-while, or it's alone??
{
printf("Statement of Account for October, 2004\n\n");
printf("Your total number of credit transactions are %d\n", option1);
printf("Your total number of debit transactions are %d\n", option2);
printf("Interest Computed: $%.2lf\n", interest);
printf("Final Balance: $%.2lf\n\n", balance);
printf("Good Bye!");
return 0;
}
//end bracket missing
Now that the code IS correctly idented try to understand it