Write a program to perform bank transaction

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class current;
class saving
   {
      private:
       char name[25];
       int accno;
       float balance;
      public:
       void getdata()
       {
           cout<<"Savings Account Details:\n";
           cout<<"Name            :";
           cin>>name;
           cout<<"\nAccount Number:";
           cin>>accno;
           cout<<"Balance Amount:";
           cin>>balance;
       }
      friend float totbalance(saving,current);
   };
   class current
   {
       private:
        char name[25];
        int accno;
        float balance;
       public:
        void getdata()
        {
           cout<<"Current Account Details\n";
           cout<<"Account Name :";
           cin>>name;
           cout<<"\nAccount Number:";
           cin>>accno;
           cout<<"\nBalance Amount:";
           cin>>balance;
        }
       friend float totbalance(saving,current);
   };

   float totbalance(saving sav,current cur)
   {
     

cout<<"***************************************";
      cout<<"\nSavings Account Balance

:Rs."<<setw(6)<<sav.balance<<endl;
      cout<<"\nCurrent Account Balance

:Rs."<<setw(6)<<cur.balance<<endl;
      return (sav.balance+cur.balance);
   }
void main()
{
  saving s;
  current c;
  clrscr();
  s.getdata();
  c.getdata();
  cout<<"\nTotal

Balance:Rs."<<setw(6)<<totbalance(s,c)<<endl;
 

cout<<"********************************************

";
  getch();
}

No comments:

Post a Comment