My Profile

Ahmednagar, Maharashtra, India
I, Das ShrikKrishna J. MCA III IMSCD&R, Ahmednagar.

Sunday, 24 July 2011

Project For Banking System (Using C)

//Project For Banking System In C Language
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<dos.h>
struct bank
{
 int accono;
 char name[20];
 float bal;
};
struct bank1
{
 int accono;
 char name[20];
 int duration;
 float bal;
 float amount;
 };
 struct bank2
 {
  char user[10];
  int pass;
  };
void main()
 {
   FILE *fp1;
  struct bank2 holder2[20],holders2;
  int ch=1,ch1,i=0,n,accono,j=0,found,ch3,nfound,ch4,nfound1,no;
  char choice,string1[10],string2[10],user[10];

  music(1);
  printf("\n\n\n\t\t\t\tBank System");
  printf("\n\t\t\t\t===========\n\n");
  printf("\t\t      Developed By Nitin Tumma(MCA-I)");
  printf("\n\t\t      ===============================\n\n\n");
  b:
  music(1);
  printf("\n\t\t   Enter the User Name:(0 to quit):");
  gets(string1);
  if(strcmp(string1,"0")==0)
  {
   exit(0);
  }
  printf("\n\t\t   Enter the Password:");
  for(i=0;i<6;i++)
  {
   string2[i]=getch();
   printf("*");
  }
  string2[i]='\0';
  i=0;
  clrscr();
  fp1=fopen("bank4.txt","r");
  while(fscanf(fp1," %s %d",&holders2.user,&holders2.pass)!=EOF)
  {
     no=holders2.pass;
     strcpy(user,holders2.user);
     if(strcmp(string1,user)==0 && strcmp(string2,no)==0)
     {
 call();
     }
     i++;
  }
  if(strcmp(string1,"nitin")==0 && strcmp(string2,"111111")==0)
   {
 call();
   }
  if(nfound==0)
  {
   clrscr();
   music(1);
   printf("\n\n\n\n\t\tYou entered incorrect user name & password:");
   printf("\n\t\t-------------------------------------------\n");
   printf("\n\t\t\t\tTry Again");
   printf("\n\t\t\t\t---------\n\n");
   goto b;
   }
   fclose(fp1);


 }
  call()
  {
  int ch3=1;
  clrscr();
  music(2);
  printf("\n\t\t    WEL-COME TO BANK OF MAHARASHTRA\n");
  printf("\t\t    -------------------------------\n");
  do
   {
   printf("\n\t\t   Which Account do u want to open:\n");
   printf("\t\t   --------------------------------\n\n");
   printf("\t\t\t\tMENU\n");
   printf("\t\t\t************************\n");
   printf("\t\t\t1.Current Account\n\t\t\t2.Saving Account\n\t\t\t3.Fixed Deposite Account\n\t\t\t4.Other\n\t\t\t5.Exit\n");
   printf("\t\t\t************************\n");
   printf("\t\t\tEnter your choice=");
   scanf("%d",&ch3);
   switch(ch3)
      {
  case 1: clrscr();
   call1(1);

  case 2: clrscr();
   call1(2);
  case 3: clrscr();
   call2();
  case 4: clrscr();
   call3();
  case 5: music(1);
   exit(0);

        default: clrscr();
   ch3=1;
   printf("\n\t\t\tEnter correct choice!!\n");
   printf("\t\t\t----------------------\n");
   printf("\n\t\t\t\tTry Again\n");
   printf("\t\t\t\t---------\n");
      }
   }while(ch3);
  }


 call1(int a)
 {
  FILE *fp1;
  struct bank holder[20],holders;
  int ch=1,ch1,i=0,n,accono,j=0,found,ch3,nfound,ch4,nfound1;
  char choice;
  clrscr();
  do
    {
     music(2);
     if(a==1)
     {
     printf("\n\t\t    WEL-COME TO CURRENT ACCOUNT\n");
     }
     else
     {
     printf("\n\t\t    WEL-COME TO SAVING ACCOUNT\n");
     }
     printf("\t\t    ===========================");
     printf("\n\n\t\t\t      MENU");
     printf("\n\t\t   *******************************");
     printf("\n\t\t    1: Create\n\t\t    2: Opening Account\n\t\t    3: Deposite Amount\n\t\t    4: Withdrawn Amount\n\t\t    5: Search Member Information\n\t\t    6: Display Member Information\n\t\t    7: Closing Account\n\t\t    8: Modify Members Information\n\t\t    9: Display Total Information\n\t\t   10: Home page");
     printf("\n\t\t   *******************************");
     printf("\n\t\t   Enter your choice=");
     scanf("%d",&ch);
     switch(ch)
     {
       case 1: clrscr();
        music(1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","w");
        }
        else
        {
        fp1=fopen("bank2.txt","w");
        }
        fclose(fp1);
        do
   {
    if(a==1)
    {
     fp1=fopen("bank1.txt","r");
    }
    else
    {
     fp1=fopen("bank2.txt","r");
    }
    printf("\nEnter Account No:");
    scanf("%d",&accono);
    nfound=0;
    while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
    {
      if(accono==holders.accono)
      {
      nfound=1;
      }
    }
    fclose(fp1);
    if(nfound==0)
    {
     if(a==1)
     {
      fp1=fopen("bank1.txt","a");
     }
     else
     {
      fp1=fopen("bank2.txt","a");
     }
     printf("\nEnter the name:");
     scanf("%s",&holder[i].name);
     printf("\nEnter the balance:");
     scanf("%f",&holder[i].bal);
     fprintf(fp1," %d %s %f\n",accono,holder[i].name,holder[i].bal);
     i++;
     fclose(fp1);
    }
    else
    {
    clrscr();
    music(1);
    printf("\nThe no already exit\nTry again\n");
    }
    printf("\nAdd more?(yes=1/no=0)");
    scanf("%d",&ch1);
    clrscr();
   }while(ch1==1);
        n=i;
        break;
       case 2: clrscr();
        i=n;
        do
        {
        music(2);
  if(a==1)
  {
   fp1=fopen("bank1.txt","r");
  }
  else
  {
   fp1=fopen("bank2.txt","r");
  }
  printf("\nEnter Account No:");
  scanf("%d",&accono);
  nfound=0;
  while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
  {
   if(accono==holders.accono)
    {
      nfound=1;
    }
  }
  fclose(fp1);
  if(nfound==0)
  {
   if(a==1)
   {
    fp1=fopen("bank1.txt","a");
   }
   else
   {
    fp1=fopen("bank2.txt","a");
   }
   printf("\nEnter the name:");
   scanf("%s",&holder[i].name);
   printf("\nEnter the balance:");
   scanf("%f",&holder[i].bal);
   fprintf(fp1," %d %s %f\n",accono,holder[i].name,holder[i].bal);
   i++;
   printf("\nAccount opened successfully");
   fclose(fp1);
   }
   else
   {
    clrscr();
    music(1);
    printf("\nThe no already exit\nTry again\n");
   }
   printf("\n\nWant to open more Account?(yes=1/no=0)");
   scanf("%d",&ch1);
   clrscr();
        }while(ch1==1);
        n=i;
        break;
       case 3: clrscr();
        music(2);
   if(a==1)
   {
    fp1=fopen("bank1.txt","r");
   }
   else
   {
    fp1=fopen("bank2.txt","r");
   }

   i=0;
   nfound=0;
   printf("\nEnter Account no:");
   scanf("%d",&accono);
   while(fscanf(fp1,"%d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
   {
     if(accono==holders.accono)
     {
       nfound=1;
       printf("\nHow much do u want to deposite=");
       scanf("%d",&ch);
       ch4=holders.bal+ch;
       holder[i].bal=holders.bal+ch;
       strcpy(holder[i].name,holders.name);
       holder[i].accono=holders.accono;
     }
     else
     {
       holder[i].accono=holders.accono;
       strcpy(holder[i].name,holders.name);
       holder[i].bal=holders.bal;
     }
     i++;
   }
   fclose(fp1);
   if(a==1)
   {
    fp1=fopen("bank1.txt","w");
   }
   else
   {
    fp1=fopen("bank2.txt","w");
   }
   for(j=0;j<i;j++)
   {
    fprintf(fp1," %d %s %f\n",holder[j].accono,holder[j].name,holder[j].bal);
   }
   if(nfound==0)
   {
     music(1);
     printf("\nIncorrect Account No\n");
   }
   else
   {
    printf("Rs %d has been deposited\nAccount having Rs. %d\n",ch,ch4);
   }
   fclose(fp1);
  break;

       case 4: clrscr();
        music(2);
        if(a==1)
        {
  fp1=fopen("bank1.txt","r");
        }
        else
        {
  fp1=fopen("bank2.txt","r");
        }
        i=0;
        nfound=0;
        printf("\nEnter Account no:");
        scanf("%d",&accono);
        while(fscanf(fp1,"%d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
        {
  if(accono==holders.accono)
  {
    nfound=1;
    nfound1=1;
    printf("\nHow much do u want to withdrawn=");
    scanf("%d",&ch);
    if((holders.bal-ch)<500)
    {
     holder[i].bal=holders.bal;
     ch4=holders.bal;
     nfound1=0;
     }
     else
     {
    holder[i].bal=holders.bal-ch;
    ch4=holders.bal-ch;
    }
    holder[i].accono=holders.accono;
    strcpy(holder[i].name,holders.name);
  }
  else
  {
    holder[i].accono=holders.accono;
    strcpy(holder[i].name,holders.name);
    holder[i].bal=holders.bal;
  }
  i++;
        }
        fclose(fp1);
        if(a==1)
        {
  fp1=fopen("bank1.txt","w");
        }
        else
        {
  fp1=fopen("bank2.txt","w");
        }
        for(j=0;j<i;j++)
        {
   fprintf(fp1," %d %s %f\n",holder[j].accono,holder[j].name,holder[j].bal);
        }
        if(nfound==0)
        {
   music(1);
   printf("\nIncorrect Account No\n");
        }
        else
        {
  if(nfound1==0)
  {
  music(1);
  printf("cannot able to withdrawn,because of min bal Rs.500 must in ur account\nAccount have only Rs. %d\n,",ch4);
  }
  else
  {
   music(1);
   printf("Your money has been withdrawn by %d\nNow account having Rs.%d",ch,ch4);
  }
        }
        fclose(fp1);
        break;


       case 5: clrscr();
        music(1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","r");
        }
        else
        {
        fp1=fopen("bank2.txt","r");
        }
        i=0;
        found=0;
        printf("\n\n\n\t\t    Enter Account No to search=");
        scanf("%d",&accono);
        while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
        {
   if(accono==holders.accono)
   {
     music(1);
     printf("\t\t    Account found at position %d\n\t\t    Detail is =>",i+1);
     printf("\n\t\t    Account No=%d, Name=%s, Balance=%.2f\n\n",holders.accono,holders.name,holders.bal);
     found=1;
   }
   i++;
        }
        if(found==0)
        {
        music(1);
  printf("\n\t\t\tAccount was not found\n\n");
        }
        fclose(fp1);
        break;


       case 6: clrscr();
        music(1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","r");
        }
        else
        {
        fp1=fopen("bank2.txt","r");
        }
        if(fp1==NULL)
        {
  music(1);
  printf("\t\tThere are no Accounts\n");
  printf("\t\t---------------------\n");
        }
        else
        {
  music(1);
  printf("\t\t  Account No.    Name      Balance");
  printf("\n\t\t  ================================");
  while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
  {
   fprintf(stdout,"\n\t\t%7d%15s%12.2f",holders.accono,holders.name,holders.bal);
  }
        printf("\n\t\t  ================================\n");
        }
        fclose(fp1);
        break;


       case 7: clrscr();
        music(1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","r");
        }
        else
        {
        fp1=fopen("bank2.txt","r");
        }
        i=0;
        found=0;
        printf("\n\t\t         Enter Account No=");
        scanf("%d",&accono);
        while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
        {
   if(accono==holders.accono)
   {
    music(1);
    printf("\n\t\t   Account Closed Successfully!!\n\n");
    found=1;
   }
   else
   {
    holder[i].accono=holders.accono;
    strcpy(holder[i].name,holders.name);
    holder[i].bal=holders.bal;
    i++;
   }
        }
        if(found==0)
        {
  music(1);
  printf("\n\t\t\tAccount was not found!!\n\n");
        }
        fclose(fp1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","w");
        }
        else
        {
        fp1=fopen("bank2.txt","w");
        }
        for(j=0;j<i;j++)
        {
  fprintf(fp1," %d %s %f\n",holder[j].accono,holder[j].name,holder[j].bal);
        }
        fclose(fp1);
        break;

       case 8: clrscr();
        music(2);
        if(a==1)
        {
    fp1=fopen("bank1.txt","r");
        }
        else
        {
    fp1=fopen("bank2.txt","r");
        }
        i=0;
        nfound=0;
        printf("\nEnter Account no to modify members information=");
        scanf("%d",&accono);
        while(fscanf(fp1,"%d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
        {
      if(accono==holders.accono)
      {
        nfound=1;
        printf("\nEnter new Account No,name,Balance=");
        scanf("%d%s%f",&holder[i].accono,&holder[i].name,&holder[i].bal);
      }
      else
      {
        holder[i].accono=holders.accono;
        strcpy(holder[i].name,holders.name);
        holder[i].bal=holders.bal;
      }
      i++;
        }
        fclose(fp1);
        if(a==1)
        {
    fp1=fopen("bank1.txt","w");
        }
        else
        {
     fp1=fopen("bank2.txt","w");
        }
        for(j=0;j<i;j++)
        {
     fprintf(fp1," %d %s %f\n",holder[j].accono,holder[j].name,holder[j].bal);
        }
        if(nfound==0)
        {
   music(1);
   printf("\nIncorrect Account No\n");
        }
        else
        {
  printf("\nInformation modified successfully\n");
        }
        fclose(fp1);
        break;
       case 9: clrscr();
        music(1);
        if(a==1)
        {
        fp1=fopen("bank1.txt","r");
        }
        else
        {
        fp1=fopen("bank2.txt","r");
        }
        if(fp1==NULL)
        {
  music(1);
  printf("\t\t\tThere are no Accounts\n");
  printf("\t\t\t---------------------\n");
        }
        else
        {
  music(1);
  i=0;
  ch=0;
  while(fscanf(fp1," %d %s %f",&holders.accono,&holders.name,&holders.bal)!=EOF)
  {
    i++;
    ch=ch+holders.bal;

  }
        printf("\n\t\t =================================");
        printf("\n\t\t      Total Balance is %d\n\t\t   Total no of Account is %d",ch,i);
        printf("\n\t\t =================================\n");
        }
        fclose(fp1);
        break;
       case 10: call();

       default:clrscr();
        music(1);
        printf("\n\t\t\tEnter Correct choice!!\n\n");
        break;

     }
    }while(ch);
 }


  call2()
 {
  FILE *fp1;
  struct bank1 holder1[20],holders1;
  int ch=1,ch1,i=0,n,accono,j=0,found,ch3,nfound,ch4,nfound1;
  char choice;
  clrscr();
  do
    {
     music(2);
     printf("\n\t\t WEL-COME TO FIXED DEPOSITE ACCOUNT\n");
     printf("\t\t ==================================");
     printf("\n\n\t\t\t      MENU");
     printf("\n\t\t   *****************************");
     printf("\n\t\t   1: Create\n\t\t   2: Opening Account\n\t\t   3: Search Member Information\n\t\t   4: Display Member Information\n\t\t   5: Closing Account\n\t\t   6: Modify Members Information\n\t\t   7: Display Total Information\n\t\t   8: Home page");
     printf("\n\t\t   *****************************");
     printf("\n\t\t   Enter your choice=");
     scanf("%d",&ch);
     switch(ch)
     {
       case 1: clrscr();
        music(1);
        fp1=fopen("bank3.txt","w");
        fclose(fp1);
        do
   {
    fp1=fopen("bank3.txt","r");
    printf("\nEnter Account No:");
    scanf("%d",&accono);
    nfound=0;
    while(fscanf(fp1," %d %s %f %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
    {
      if(accono==holders1.accono)
      {
      nfound=1;
      }
    }
    fclose(fp1);
    if(nfound==0)
    {

     fp1=fopen("bank3.txt","a");
     printf("\nEnter the name:");
     scanf("%s",&holder1[i].name);
     b:
     printf("\nEnter the duration of deposite:");
     scanf("%d",&holder1[i].duration);
  //   if(holder1[i].duration!=5 || holder1[i].duration!=2 || holder1[i].duration!=1)
   //  {
    //  printf("\nDuration must among 5 or 2 or 1");
    //  goto b;
    // }
     printf("\nEnter the Amount:");
     scanf("%f",&holder1[i].bal);
     if(holder1[i].duration==5)
     {
     holder1[i].amount=holder1[i].bal*2;
     }
     else
     {
      if(holder1[i].duration==2)
      {
       holder1[i].amount=holder1[i].bal+holder1[i].bal*15;
      }
      else
      {
      holder1[i].amount=holder1[i].bal+holder1[i].bal*10;
      }
     }
     fprintf(fp1," %d %s %d %f %f\n",accono,holder1[i].name,holder1[i].duration,holder1[i].bal,holder1[i].amount);
     i++;
     fclose(fp1);
    }
    else
    {
    clrscr();
    music(1);
    printf("\nThe no already exit\nTry again\n");
    }
    printf("\nAdd more?(yes=1/no=0)");
    scanf("%d",&ch1);
    clrscr();
   }while(ch1==1);
        n=i;
        break;
       case 2: clrscr();
        i=n;
        do
        {
        music(2);
        fp1=fopen("bank3.txt","r");
        printf("\nEnter Account No:");
  scanf("%d",&accono);
  nfound=0;
  while(fscanf(fp1," %d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
  {
   if(accono==holders1.accono)
    {
      nfound=1;
    }
  }
  fclose(fp1);
  if(nfound==0)
  {
  fp1=fopen("bank3.txt","a");
  printf("\nEnter the name:");
  scanf("%s",&holder1[i].name);
  c:
  printf("\nEnter the duration of deposite:");
  scanf("%d",&holder1[i].duration);
       // if(holder1[i].duration!=5 || holder1[i].duration!=2 || holder1[i].duration!=1)
       // {
  //    printf("\nDuration must among 5 or 2 or 1");
   //   goto c;
       // }
  printf("\nEnter the Amount:");
  scanf("%f",&holder1[i].bal);
  if(holder1[i].duration==5)
  {
     holder1[i].amount=holder1[i].bal*2;
  }
  else
  {
      if(holder1[i].duration==2)
      {
       holder1[i].amount=holder1[i].bal+holder1[i].bal*15;
      }
      else
      {
      holder1[i].amount=holder1[i].bal+holder1[i].bal*10;
      }
  }
  fprintf(fp1," %d %s %d %f %f\n",accono,holder1[i].name,holder1[i].duration,holder1[i].bal,holder1[i].amount);
  i++;
  printf("\nAccount opened successfully");
  fclose(fp1);
  }
  else
  {
    clrscr();
    music(1);
    printf("\nThe no already exit\nTry again\n");
  }
  printf("\n\nWant to open more Account?(yes=1/no=0)");
  scanf("%d",&ch1);
  clrscr();
        }while(ch1==1);
        n=i;
        break;



       case 3: clrscr();
        music(1);
        fp1=fopen("bank3.txt","r");
        i=0;
        found=0;
        printf("\n\n\n\t\t    Enter Account No to search=");
        scanf("%d",&accono);
        while(fscanf(fp1," %d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
        {
   if(accono==holders1.accono)
   {
     music(1);
     printf("\t\t    Account found at position %d\n\t\t    Detail is =>",i+1);
     printf("\n\t\t    Account No=%d, Name=%s, Duration=%d\n\t\t    Deposite Amount=%.2f, Total Amount%.2f\n\n",holders1.accono,holders1.name,holders1.duration,holders1.bal,holders1.amount);
     found=1;
   }
   i++;
        }
        if(found==0)
        {
        music(1);
  printf("\n\t\t\tAccount was not found\n\n");
        }
        fclose(fp1);
        break;


       case 4: clrscr();
        music(1);
        fp1=fopen("bank3.txt","r");
        if(fp1==NULL)
        {
  music(1);
  printf("\t\t\tThere are no Accounts\n");
  printf("\t\t\t---------------------\n");
        }
        else
        {
  music(1);
  printf("      Account No.    Name      Duration  Deposite Amount  Total Amount");
  printf("\n      ================================================================");
  while(fscanf(fp1," %d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
  {
   fprintf(stdout,"\n    %7d%15s%12d%12.2f%17.2f",holders1.accono,holders1.name,holders1.duration,holders1.bal,holders1.amount);
  }
        printf("\n      ================================================================\n");
        }
        fclose(fp1);
        break;


       case 5: clrscr();
        music(1);
        fp1=fopen("bank3.txt","r");
        i=0;
        found=0;
        printf("\n\t\t         Enter Account No=");
        scanf("%d",&accono);
        while(fscanf(fp1," %d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
        {
   if(accono==holders1.accono)
   {
    music(1);
    printf("\n\t\t   Account Closed Successfully!!\n\n");
    found=1;
   }
   else
   {
    holder1[i].accono=holders1.accono;
    strcpy(holder1[i].name,holders1.name);
    holder1[i].duration=holders1.duration;
    holder1[i].bal=holders1.bal;
    holder1[i].amount=holders1.amount;
    i++;
   }
        }
        if(found==0)
        {
  music(1);
  printf("\n\t\t\tAccount was not found!!\n\n");
        }
        fclose(fp1);
        fp1=fopen("bank3.txt","w");
        for(j=0;j<i;j++)
        {
  fprintf(fp1," %d %s %d %f %f\n",holder1[j].accono,holder1[j].name,holder1[j].duration,holder1[j].bal,holder1[j].amount);
        }
        fclose(fp1);
        break;

       case 6: clrscr();
        music(2);
        fp1=fopen("bank3.txt","r");
        i=0;
        nfound=0;
        printf("\nEnter Account no=");
        scanf("%d",&accono);
        while(fscanf(fp1,"%d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
        {

        if(accono==holders1.accono)
        {
  clrscr();
  nfound=1;
  printf("\nEnter new Account no=");
        scanf("%d",&holder1[i].accono);
        printf("\nEnter the name:");
        scanf("%s",&holder1[i].name);
  d:
  printf("\nEnter the duration of deposite:");
  scanf("%d",&holder1[i].duration);
        // if(holder1[i].duration!=5 || holder1[i].duration!=2 || holder1[i].duration!=1)
      // {
       //     printf("\nDuration must among 5 or 2 or 1");
       //     goto d;
        // }
  printf("\nEnter the Amount:");
  scanf("%f",&holder1[i].bal);
  if(holder1[i].duration==5)
  {
     holder1[i].amount=holder1[i].bal*2;
  }
  else
  {
      if(holder1[i].duration==2)
      {
       holder1[i].amount=holder1[i].bal+holder1[i].bal*15;
      }
      else
      {
      holder1[i].amount=holder1[i].bal+holder1[i].bal*10;
      }
  }
        }
        else
        {
        holder1[i].accono=holders1.accono;
        strcpy(holder1[i].name,holders1.name);
        holder1[i].duration=holders1.duration;
        holder1[i].bal=holders1.bal;
        holder1[i].amount=holders1.amount;
      }
      i++;
        }

        fclose(fp1);
        fp1=fopen("bank3.txt","w");
        for(j=0;j<i;j++)
        {
     fprintf(fp1," %d %s %d %f %f\n",holder1[j].accono,holder1[j].name,holder1[j].duration,holder1[j].bal,holder1[j].amount);
        }
        if(nfound==0)
        {
   music(1);
   printf("\nIncorrect Account No\n");
        }
        else
        {
  printf("\nInformation modified successfully\n");
        }
        fclose(fp1);
        break;

       case 7: clrscr();
        music(1);
        fp1=fopen("bank3.txt","r");
        if(fp1==NULL)
        {
  music(1);
  printf("\t\t\tThere are no Accounts\n");
  printf("\t\t\t---------------------\n");
        }
        else
        {
  music(1);
  i=0;
  ch=0;
  ch1=0;
  while(fscanf(fp1," %d %s %d %f %f",&holders1.accono,&holders1.name,&holders1.duration,&holders1.bal,&holders1.amount)!=EOF)
  {
    i++;
    ch=ch+holders1.bal;
    ch1=ch1+holders1.amount;
  }

        printf("\n\t\t ====================================");
        printf("\n\t\t   Total Deposited Amount is %d\n\t\t   Total no of Account is %d\n\t\t   Total Amount to be payable is %d",ch,i,ch1);
        printf("\n\t\t ====================================\n");
        }
        fclose(fp1);
        break;
       case 8: call();

       default:clrscr();
        music(1);
        printf("\n\t\t\tEnter Correct choice!!\n\n");
        break;

     }
    }while(ch);
 }
  call3()
   {
    FILE *fp1;
  struct bank2 holder2[20],holders2;
  int ch=1,ch1,i=0,n,accono,j=0,found,ch3,nfound,ch4,nfound1,no;
  char choice,string1[10],string2[10],user[10];
   clrscr();
   do
    {
     music(2);
     printf("\t\t    ===========================");
     printf("\n\n\t\t\t      MENU");
     printf("\n\t\t   *******************************");
     printf("\n\t\t    1: Create User\n\t\t    2: Add User\n\t\t    3: Modify Password  4: Delete User\n\t\t    5: Home page\n\t\t");
     printf("\n\t\t   *******************************");
     printf("\n\t\t   Enter your choice=");
     scanf("%d",&ch);
     switch(ch)
     {
       case 1: clrscr();
        music(1);
        fp1=fopen("bank4.txt","w");
        fclose(fp1);
        do
        {
    fp1=fopen("bank4.txt","r");
    printf("\nEnter User Name:");
    gets(user);
    printf("\nEnter password:");
    scanf("%d",&accono);
    nfound=0;
    while(fscanf(fp1," %s %d",&holders2.user,&holders2.pass)!=EOF)
    {
      if(strcmp(accono,holders2.pass)==0 && strcmp(user,holders2.user)==0)
      {
      nfound=1;
      }
    }
    fclose(fp1);
    if(nfound==0)
    {
     fp1=fopen("bank4.txt","a");
     fprintf(fp1," %s %d\n",user,accono);
     i++;
     fclose(fp1);
    }
    else
    {
    clrscr();
    music(1);
    printf("\nThe user already exit\nTry again\n");
    }
    printf("\nAdd more?(yes=1/no=0)");
    scanf("%d",&ch1);
    clrscr();
   }while(ch1==1);
        n=i;
        break;
       case 2: clrscr();
        i=n;
        do
        {
        music(2);
        fp1=fopen("bank4.txt","r");
        printf("\nEnter User Name:");
        gets(user);
        printf("\nEnter password:");
        scanf("%d",&accono);
        nfound=0;
        while(fscanf(fp1," %s %d",&holders2.user,&holders2.pass)!=EOF)
  {
     if(strcmp(accono,holders2.pass)==0 && strcmp(user,holders2.user)==0)
    {
      nfound=1;
    }
  }
  fclose(fp1);
  if(nfound==0)
  {
   fp1=fopen("bank4.txt","a");
   fprintf(fp1," %s %d\n",user,accono);
   i++;
   printf("\nNew user added successfully");
   fclose(fp1);
   }
   else
   {
    clrscr();
    music(1);
    printf("\nThe user already exist\nTry again\n");
   }
   printf("\n\nWant to add more user?(yes=1/no=0)");
   scanf("%d",&ch1);
   clrscr();
        }while(ch1==1);
        n=i;
        break;

     case 3: clrscr();
        music(2);
        fp1=fopen("bank4.txt","r");
        i=0;
        nfound=0;
        printf("\nEnter User Name=");
        gets(user);
        printf("\nEnter the password=");
        scanf("%d",&accono);
        while(fscanf(fp1," %s %d",&holders2.user,&holders2.pass)!=EOF)
        {
     if(strcmp(accono,holders2.pass)==0 && strcmp(user,holders2.user)==0)

      {
        nfound=1;
        printf("\nEnter new password=");
        scanf("%d%s%f",&holder2[i].pass);
        strcpy(holder2[i].user,user);
      }
      else
      {
        holder2[i].pass=holders2.pass;
        strcpy(holder2[i].user,holders2.user);
      }
      i++;
        }
        fclose(fp1);
        fp1=fopen("bank4.txt","w");
        for(j=0;j<i;j++)
        {
     fprintf(fp1," %s %d\n",holder2[j].user,holder2[j].pass);
        }
        if(nfound==0)
        {
   music(1);
   printf("\nIncorrect User No\n");
        }
        else
        {
  printf("\nModified successfully\n");
        }
        fclose(fp1);
        break;

       case 4: clrscr();
        music(1);
        fp1=fopen("bank4.txt","r");
        i=0;
        found=0;
        printf("\n\t\t         Enter User Name=");
        gets(user);
        printf("\n\t\t         Enter password=");
        scanf("%d",&accono);
        while(fscanf(fp1," %s %d",&holders2.user,&holders2.pass)!=EOF)
        {
    if(strcmp(accono,holders2.pass)==0 && strcmp(user,holders2.user)==0)
    {

    music(1);
    printf("\n\t\t    User Deleted Successfully!!\n\n");
    found=1;
   }
   else
   {
    holder2[i].pass=holders2.pass;
    strcpy(holder2[i].user,holders2.user);
    i++;
   }
        }
        if(found==0)
        {
  music(1);
  printf("\n\t\t\tUser was not found!!\n\n");
        }
        fclose(fp1);
        fp1=fopen("bank4.txt","w");
        for(j=0;j<i;j++)
        {
  fprintf(fp1," %s %d\n",holder2[j].user,holder2[j].pass);
        }
        fclose(fp1);
        break;


       case 5: call();
       default:clrscr();
        music(1);
        printf("\n\t\t\tEnter Correct choice!!\n\n");
        break;

     }
    }while(ch);

   }
  }

 music(int type)
 {
 float octave[7]={130.81,146.83,164.81,174.61,196,220,246.94};
 int n,i;
 switch(type)
 {
 case 1 :
 for(i=0;i<7;i++)
 {
 sound(octave[i]*8);
 delay(30);
 }
 nosound();
 break;

 case 2:
 for(i=0;i<15;i++)
 {
 n=random(7);
 sound(octave[n]*4);
 delay(100);
 }
 nosound();
 break;

 case 3:
 while(!kbhit())
 {
 n=random(7);
 sound(octave[n]*4);
 delay(100);
 }
 nosound();
 if(getch()==0)
 getch();
 break;
 case 4:
 for(i=4;i>=0;i--)
 {
 sound(octave[i]*4);
 delay(15);
 }
 nosound();
 break;

 case 5:
 sound(octave[6]*2);
 delay(50);
 nosound();
 }
}



 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | cheap international calls