Subscribe Now: standard

Monday, December 14, 2009

C++ source code - Bank transaction simulation


hai
this is a simple program that does the following things.
  • accept name and account number.
  • gives a menu selection to DEPPOSIT or WITHDRAW cash.
  • Controls withdrawal depending on cash balance.
  • Print a detailed sheet with details of all transactions
INCLUDE THE FOLLOWING LIBRARIES:
iostream.h
string.h

===========================code=================




struct trans{
    long int  bal,amont;
    char act,dat[10];
}action[10];
struct cust{
    char nam[25];
    long int baln,accn;
}omer;

int i=0;

int main()
{
    omer.baln=0;
    char y;
    int x;
    void depo();
    void vido();
    cout<<"Enter NAME:";
    cin>>omer.nam;
    cout<<"Enter account number:";
    cin>>omer.accn;
    do{
        cout<<"[1] Depposit\n";
        if(omer.baln>0)
        {
            cout<<"[2] Withdraw\n";
        }else
        {
            cout<<"YOUR BALANCE IS 0 ,PLEASE DEPOSIT A SUM BEFORE OTHER TRANSACTIONS.\n";
        }
        cout<<"OPTION:";
        cin>>x;

        if(x==1)
        {
            depo();
        }
        if(x==2)
        {
            vido();
        }
        cout<<"\nDO YOU WANT TO CONTINUE[y/n]:";
                cin>>y;
    }while(y=='y'||y=='Y');

        void balance();
        balance();
}



void depo()
{
    cout<<"\n\nEnter Date (format- dd/mm/yyyy) :";
            cin>>action[i].dat;
    cout<<"Enter amount to deposit:";
    cin>>action[i].amont;
    omer.baln+=action[i].amont;
   
    action[i].act='D';
i++;
}

void vido()
{
    cout<<"\n\nEnter Date (format- dd/mm/yyyy) :";
            cin>>action[i].dat;
    cout<<"Enter amount to deposit:";
    cin>>action[i].amont;
    if(omer.baln>action[i].amont)
    {
        omer.baln-=action[i].amont;
   
    action[i].act='W';
i++;

    }else
    {
        cout<<"\n***YOU DONOT HAVE ENOUGH BALANCE***\a\a";
    }
}


void balance()
{
    cout<<"\n\n\n";
    cout<<"NAME:"<<<"\t\t\t\t\t"<<"ACC:"<
    cout<<"\n========================================================\n";
    cout<<"Si|\tAMOUNT|\tTRANSACTION|\tDATE|\tBALANCE|\n";
    for(int k=0;k
    {
        cout<<<"\t"<<<"\t"<<<"\t"<<<"\t"<
        cout<<"\n";
    }
    cout<<"========================================================\n";
    cout<<"BALANCE: "<
}





===========================END====================

No comments:

Post a Comment