Bank Software - C++

#include<iostream>
#include<string>

using namespace std;
class account
 { struct bank{
    string name;
    float bal;
    int ac;
    }ba[10];
   
    int m;
    int n,t,q,e;
    float k,amo;
  
   public :
   
  
   int creat(int x,int t)
     { n=x;
       cout<<"\nEnter name:";
       cin>>ba[t].name;
       cout<<"\nYour Account number is :"<<n;
       ba[t].ac=n;
       cout<<"\nSelect account type\n1.SAVINGS\n2.CURRENT";
       cin>>m;
       cout<<"\nSuccessfully created an account!\n";
       a: cout<<"\ndeposite initial amount:";
       cin>>k;
       if(k<500)
       {
        cout<<"\n\nMinimum amount should be 500.Please re-deposite";
        goto a;
        }
       
       else
       { ba[t].bal=k;
        cout<<"\nBalance is:Rs."<<ba[t].bal;
        }
        return n;
      }
     void deposite()
      {
        cout<<"\nEnter account number";
           cin>>q;
           if(q<100)
            cout<<"\nInvalid account number";
           else
           {
           for(e=1;e<=10;++e)
             {
               if(ba[e].ac==q)
                break;
                }
        cout<<"\nEnter the amount to deposite:";
        cin>>amo;
        ba[e].bal=ba[e].bal+amo;
        }
       }
      void withdraw()
       {
          cout<<"\nEnter account number";
           cin>>q;
           if(q<100)
            cout<<"\nInvalid account number";
           else
           {
           for(e=1;e<=10;++e)
             {
               if(ba[e].ac==q)
                break;
                }
        
        
         cout<<"\nEnter the amount to withdraw";
         cin>>amo;
       
         if((ba[e].bal-amo)<500)
          {
           cout<<"Sorry!minimum amount should be 500.Please retry";
           }
          else
            ba[e].bal=ba[e].bal-amo;
             cout<<"\nBalance is:Rs."<<ba[e].bal;
           }
        }
        void display()
         { cout<<"\nEnter account number";
           cin>>q;
           if(q<100)
            cout<<"\nInvalid account number";
           else
           {
            for(e=1;e<=10;++e)
             {
               if(ba[e].ac==q)
                break;
                }
           cout<<"\nName is:"<<ba[e].name;
           cout<<"\nNew Balance is:"<<ba[e].bal;
           }
         }
          };
      int main()
       { int i=100,j,z,h=1;
         account ob1;
         int ch,k=1;
         while(k==1)
         {
          cout<<"\nMENU\n\n1.TO CREATE ACCOUNT\n2.TO CHECK BALANCE\n3.TO DEPOSITE\n4.TO WITHDRAW\n5.EXIT\nENTER YOUR CHOICE:";
          cin>>ch;
          switch(ch)
             {
                 case 1:
                        cout<<"Enter details of customer:\n";
                        j=ob1.creat(i,h);
                        i++;h++;
                       
                        break;
                case 2:ob1.display();
                         break;
                  case 3: ob1.deposite();
                          break;
                   case 4:ob1.withdraw();
                          break;
                    case 5:k=0;
                           break;
                }
             }
             return 0;
          }
                        
Output:
students@cselab-desktop:~$ g++ ban.cpp
students@cselab-desktop:~$ ./a.out

MENU

1.TO CREATE ACCOUNT
2.TO CHECK BALANCE
3.TO DEPOSITE
4.TO WITHDRAW
5.EXIT
ENTER YOUR CHOICE:1
Enter details of customer:

Enter name:hiran

Your Account number is :100
Select account type
1.SAVINGS
2.CURRENT1

Successfully created an account!

deposite initial amount:100


Minimum amount should be 500.Please re-deposite
deposite initial amount:500

Balance is:Rs.500
MENU

1.TO CREATE ACCOUNT
2.TO CHECK BALANCE
3.TO DEPOSITE
4.TO WITHDRAW
5.EXIT
ENTER YOUR CHOICE:2

Enter account number100

Name is:hi
New Balance is:500
MENU

1.TO CREATE ACCOUNT
2.TO CHECK BALANCE
3.TO DEPOSITE
4.TO WITHDRAW
5.EXIT
ENTER YOUR CHOICE:4

Enter account number100

Enter the amount to withdraw100
Sorry!minimum amount should be 500.Please retry
Balance is:Rs.500
MENU

1.TO CREATE ACCOUNT
2.TO CHECK BALANCE
3.TO DEPOSITE
4.TO WITHDRAW
5.EXIT
ENTER YOUR CHOICE:5
students@cselab-desktop:~$

2 comments:

  1. Thank you for such a sweet tutorial - all this time later, I've found it and love the end result. I appreciate the time you spent sharing your skills.
    www.baixar-whatsapp.com.br

    ReplyDelete
  2. I was very impressed by this post, this site has always been pleasant news. Thank you very much for such an interesting post. Keep working, great job! In my free time, I like play game: superfighters2.net. What about you?

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...