Free Aang Cursors at www.totallyfreecursors.com

Senin, 16 Februari 2015

Banking Management System.


    #include<iostream.h>
    #include<stdio.h>
    #include<conio.h>

    class bank
    {
     private:

     int ac_no,account;
     float balance;
     char name[20];

     public:
     void open(void);
     void deposite(int);
     void withdraw(int);
     void search(int);
     void display(void);

    };

    void bank::open(void)

     {
         cout<<"ENTER YOUR NAME :  ";
         cin>>name;
         cout<<"ENTER YOUR ACCOUNT NUMBER :  ";
         cin>>account;
         cout<<"ENTER THE AMOUNT OF MONEY : BDT  ";
         cin>>balance;
     }

          void bank::deposite(int j)

    {
          int bnc;

          if(account==j)

       {
        cout<<"ENTER THE AMOUNT OF MONEY : BDT ";
        cin>>bnc;
        balance=balance+bnc;
        cout<<"\n\n\tJOB HAS DONE WELL !!! \n";
       }


    }

    void bank::withdraw(int k)
    {
           int blnc,p;

      if(account==k)

      {
        cout<<"YOUR CURRENT ACCOUNT BALANCE IS BDT "<<balance<<"\n"<<"THE AMOUNT OF MONEY YOU WANT TO WITHDRAW IS BDT ";
        cin>>blnc;
           p=balance-blnc;
           { if(p<0)
              cout<<"SORRY !!! THERE IS NOT ENOUGH MONEY IN YOUR ACCOUNT\n";
            else if(p>=0)
              {
                cout<<"\n\tYOUR REQUEST TO WITHDRAW MONEY HAS DONE\n\n";
                balance=p;
              }

           }
       }

    }


    void bank::display(void)
    {    cout<<"\n\nNAME : "<<name<<"\n\nACCOUNT NO. "<<account<<"\n\nBALANCE : BDT "<<balance<<"\n\n";
    }



    void bank::search(int m)

    {

     if(account==m)
       {
         cout<<"\n\n*******Account Holder's INFO*******";
         cout<<"\n\nNAME : "<<name<<"\n\nACCOUNT NO. "<<account<<"\n\nBALANCE : BDT "<<balance<<"\n\n";
         cout<<"\n***************************************\n\n";
       }

    }

       void main()
       {
      int i,j,k,m,l,y=0;
         bank b[20];
        int index;
              textcolor(0);
             textbackground(4);
            clrscr();

          do
        {
    cout<<"\a\nPRESS 1 TO OPEN ACCOUNT\n\n"<<"PRESS 2 TO DEPOSITE AMOUNT\n\n"<<"PRESS 3 TO WITHDRAW MONEY \n\n"<<"PRESS 4 TO DISPLAY \n\n"<<"PRESS 5 TO SEARCH \n\n"<<"PRESS 6 TO EXIT \n\n\t\n";
    cout<<"Your option......";

    cin>>index;
               switch(index)
            {
               case 1:
                 cout<<"\nHOW MANY ACCOUNT YOU WANT TO OPEN?\n"; //opening account
                 cin>>y;
                  for(i=0;i<y;i++)
                b[i].open();
               break;
              case 2:
                 cout<<"\nENTER YOUR ACCOUNT NO. ";             //deposite amount
                 cin>>j;
                 for(i=0;i<y;i++)
                  {
                    b[i].deposite(j);
                  }
              break;
              case 3:
                cout<<"\nENTER YOUR ACCOUNT NO. ";              //withdraw money
                cin>>k;
                for(i=0;i<y;i++)
                   {
                   b[i].withdraw(k);
                   }
                break;

              case 4:
                for(i=0;i<y;i++)
                  {                                             //display option
                  b[i].display();
                  }
                break;
              case 5:
                cout<<"\nENTER YOUR ACCOUNT NO. ";              //search option
                cin>>m;
                 for(i=0;i<y;i++)
                {
                b[i].search(m);
                }
                 break;
             case 6:
             break;

                default:cout<<"\nYOU HAVE PRESSED THE WRONG KEY. PLEASE TRY AGAIN. \n\n\n";
                break;
            }
           }     while(index!=6);
    }




Banking Management System.

#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream.h>


class cus
{
  public:
  char name[20];
  float blnc;
  int ac_no;
  void input();

};


void cus::input()
{

  cout<<"\n\nname:";
 cin>>name;
 cout<<"\n\naccount no:";
 cin>>ac_no;
 cout<<"\n\n balance:";
 cin>>blnc;


};

///////////////////////////////

class acc:public cus
{
public:
float intrst;
int tim;
void add();
void output();
acc();
};

acc::acc()
{
tim=0;
intrst=0;
}

void acc::output()
{
 cout<<"\n\nname:"<<name;
 cout<<"\n\n total balance:"<<blnc;
 cout<<"\n\ninterest:"<<intrst;
}


void acc::add()
{
 int i;
 tim++;
 cout<<"\n\n Amount:";
 cin>>i;
 intrst=intrst+blnc*tim*.07;
 blnc=blnc+intrst+i;

};

class loan:public acc
{
public:
float lon;
loan()
{
lon=0;
}
void payloan();
void getloan();
};


void loan::getloan()
{
  int l;
  if(lon==0)
  {
    cout<<"Enter loan:";
    cin>>l;
    if(l<=(l*1.50))
    {
    cout<<"\n\n\tyou can get loan";
    lon=l+l*0.1;
    }

    else
    {
     cout<<"\n \n\tSorry.";
     lon=0;
    }
    }
    else
     cout<<"\n\n\tYou have previous loan.";
}


void loan::payloan()
{
  int m;
  if(lon==0)
  cout<<"\n\n\t You have no loan.";
  else
  {
    cout<<"\n\n\t You have to pay "<<lon;
    cout<<"\n\nEnter your payment";
    cin>>m;
    lon=lon-m;
    if(lon<=0)
    {
    cout<<"\n\n\tok your loan paid.";
    lon=0;
    }
    else
    cout<<"loan to be paid="<<lon;
}
}

void show()
{
 loan a;
 int i,found=0;
 fstream file;

 file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);
 file.seekg(0);

 cout<<"\n\nInsert account no:";
 cin>>i;
 for(;;)
 {
    file.read((char*)&a,sizeof(a));
    if(!file)
    break;

 if(i==a.ac_no)
 {
  a.output();
  found=1;
  break;
 }
 }
 if(found!=1)
  cout<<"\nNot exist.";
  file.close();

 getch();
};

void add_a()
{
 loan a;
 fstream file;
 int i,k,found=0;
 cout<<"\n\nInsertaccount no:";
 cin>>i;
 file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);
 file.seekg(0);
 for(k=0;;k++)
 {
     file.read((char*)&a,sizeof(a));
     if(!file)
     break;
    if(i==a.ac_no)
    {
     a.add();
     found=1;

     break;
    }

 }
 if(found==1)
 {
 cout<<" K="<<k;
  int d=sizeof(a);
  cout<<"OBject="<<d;
  int n=k*sizeof(a );
    file.seekp(n);
  file.write((char*)&a,sizeof(a));
  cout<<"\n\n\tInformation added to file.";
  file.close();
 }
 else
  cout<<"\n\n\t This account is not exist in file.";

 getch();

};


void dlt()
{
loan a[100];
 fstream file;
  file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);

 int i,l,found=0;
 cout<<"\n\n insert account no:";
 cin>>i;
 file.seekg(0);

 for(int k=0;;k++)
 {
     file.read((char*)&a[k],sizeof(a[k]));
      if(!file)
      break;

  }
 file.close();
 file.open("final.text",ios::out|ios::binary);
  for(l=0;l<k;l++)
 {
    if(i==a[l].ac_no)
    {
     cout<<"\n\n\t Record deleted.";
     found=1;
    }
    else
     file.write((char*)&a[l],sizeof(a[l]));

  }
    if(found==0)
    cout<<"\n\n\t Record is not in file.";
    file.close();
  getch();


};


void loanf()
{
 loan a;
 fstream file;
 file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);
  int i,found=0;
 cout<<"\n\naccount no:";
 cin>> i;
 file.seekg(0);
 for(int k=0;;k++)
 {
        file.read((char*)&a,sizeof(a));
        if(!file)
      break;

    if(i==a.ac_no)
    {
    a.getloan();
    int n=k*sizeof(a);
    file.seekp(n);
    file.write((char*)&a,sizeof(a));
    found=1;
    break;

    }
    }
    file.close();
        if(found==0)
         cout<<"\n\n\t This account is not exist in file.";

 getch();
};

void pay()
{
loan a;
 fstream file;
 file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);

 int i,found=0;
 cout<<"Account no:";
 cin>>i;
 file.seekg(0);

 for(int k=0;;k++)
 {file.read((char*)&a,sizeof(a));
    if(!file)
      break;

 if(i==a.ac_no)
 {
 a.payloan();
 int n=k*sizeof(a);
    file.seekp(n);
    file.write((char*)&a,sizeof(a));
    found=1;
    break;
 }
 }
 if(found==0)
 {
 cout<<"\n\n\t This account is not exist in file.";
 }
 file.close();

 getch();
};


void inputdata(loan a)
{
 fstream file;

 file.open("final.text",ios::ate|ios::in|ios::out|ios::binary);
 file.seekp(0,ios::end);
 file.clear();
 file.write((char*)&a,sizeof(a));
 file.close();

 }



/////////////MAIN PROGRAM//////////////////

int main()
{
     int i;


 for(;;)
 {
  loan a;
  clrscr();
  cout<<"\n\n\t<<<<<<<<<<<<<<<<<<MENU>>>>>>>>>>>>>>>>>>>>>>>>\n";

          cout<<"________________________________________________\n";
          cout<<"________________________________________________\n" ;
          cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
  cout<<"\n\n\n\n\t 1.input. \n\n\t 2.output\n\n\t 3.Add\n\n\t 4.Delete\n\n\t  5.loan\n\n\t 6.pay\n\n\t7.Exit\n\n\t  your choice:";
  cin>>i;
  switch(i)
  {
    case 1:a.input();inputdata(a);
             break;
    case 2:show();
    break;
    case 3:add_a();
    break;
    case 4:dlt();
    break;

    case 5:loanf();
    break;
     case 6:pay();
    break;
     default:exit(0);
  }
 }
// return 0;
}

Tidak ada komentar:

Posting Komentar