I can't run my program using this code. Please help me to edit it with the same function. Thanks in advance.
#include<stdio.h>
#include <stdlib.h>
main()
{
FILE * fp;
int bmenu,amenu,an;
float balance=0,deposit=0,withdraw=0;
char c,quit,name[50],address[50];
clrscr();
printf("**********BANK MENU**********\n");
printf(" ---- ---- \n");
printf("What do you want to do?\n");
printf("[1] Log-in Account\n[2] Create Account\n[3] Quit\n\nEnter the number of choice: \n");
scanf("%d",&bmenu);
printf("_____________________________\n");
if (bmenu==1)
{
printf("Account Number: ");
scanf("%d",&an);
clrscr();
printf("************Account Menu************\n");
printf(" ------- ---- \n");
printf("[1] Deposit\n[2] Withdraw\n[3] View Account Details\n[4] Quit\n\nEnter the number of choice: \n");
scanf("%d",&amenu);
printf("____________________________________\n");
if (amenu==1)
{
fp=fopen("bankaccount.txt","a");
printf("Enter the amount to be deposit: ");
scanf("%f",&deposit);
balance=balance+deposit;
printf("You now have a balance of %f\n",balance);
printf("Quit? [Enter 'Y' to exit or 'N' to go back to account menu]: ");
scanf("%s",&quit);
fprintf(fp,"Account #%d\n",an);
fprintf(fp,"%s\n",name);
fprintf(fp,"%s\n",address);
fprintf(fp,"Account Balance: %f\n",balance);
} while(quit=='n'||quit=='N');
else if (amenu==2)
{
fp=fopen("bankaccount.txt","a");
printf("Enter the amount to be withdraw: ");
scanf("%f",&withdraw);
balance=balance-withdraw;
printf("You now have a balance of %f\n",balance);
printf("Quit? [Enter 'Y' to exit or 'N' to go back to account menu]: ");
scanf("%s",&quit);
fprintf(fp,"Account #%d\n",an);
fprintf(fp,"%s\n",name);
fprintf(fp,"%s\n",address);
fprintf(fp,"Account Balance: %f\n",balance);
} while(quit=='n'||quit=='N');
else if (amenu==3)
{
fp=fopen("bankaccount.txt","r");
if(fp==NULL)
{
printf("File doesn't exist.");
}
else
{
do
{
c=getc(fp);
putchar(c);
} while(c!=EOF);
}
}
else if (amenu>3)
{
clrscr();
printf("Quitting...");
}
}
else if (bmenu==2)
{
fp=fopen("bankaccount.txt","a");
printf("Enter Name: ");
scanf("%s",&name);
printf("Enter Address: ");
scanf("%s",&address);
an=random(10000);
printf("New account creation successful...\n");
printf("Your Account Number is: %d",an);
fprintf(fp,"Account #%d\n",an);
fprintf(fp,"%s\n",name);
fprintf(fp,"%s\n",address);
fprintf(fp,"Account Balance: %f\n",balance);
printf("Quit? [Enter 'Y' to exit or 'N' to go back to account menu]: ");
scanf("%s",&quit);
break;
} while(quit=='n'||quit=='N');
else if (bmenu>2):
{
printf("Quit");
}
getch();
}