Im trying to set this do while loop in my code and it keeps giving me an error .
it says i have a parse error before "{" its the one right up under where the "while" loop starts. Im not done with my equations (ex. intrest) so you dont have to pay that any attention i just need to have the do while loop format right.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) { 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; }



LinkBack URL
About LinkBacks


