Bank Accounts Record Using C++ Programming

Bank Accounts Record:
This example is like ..... how many customers you have , and each customers have how many accounts.
Customer name , address , phone number , number of accounts and for each account , bank branch name , account number and balance.


Program code:

#include <iostream>
#include<conio.h>
using namespace std;
int main()
{
struct customer
    {
      char name[20];
      char address[30];
      int phone_no;
        struct account
        {
             char b_name[20];
             int account_no;
             float balance;
        }acc[50];
    } cust[100];
   
int i,j,n,m;
cout<<endl;

cout<<"********************************************************************"<<endl;
cout<<"                        Bank Accounts Record                        "<<endl;
cout<<"********************************************************************"<<endl<<endl;

cout<<" How many customer in the bank: ";
cin>> n;
cout<<" How many account number in the branch : ";
cin>> m ;
cout<<endl<<endl;
cout<<"<<Enter the customer data>>"<<endl;

   for(i=1 ;i<=n;i++)
   {
     cout<<"Enter customer name, address and phone no :  "<<endl;    
      cin>> cust[i].name>> cust[i].address>>cust[i].phone_no;
      cout<<endl<<endl;
       cout<<"<<Enter the bank branch data>>                 "<<endl;
       for(j=1 ;j<=m;j++)
       {
           cout<<"Enter branch name, account number and balance:  "<<endl;
           cin>> cust [i] . acc [j] . b_name>> cust[ i] . acc [j] . account_no >>cust[i] .acc[j].balance;  
           cout<<endl<<endl;
       }
   }
      cout<<"********************************************************************"<<endl;
 cout<<"                Customer Data is as:                "<<endl<<endl;
      for(i=1;i<=n;i++)
      {
          cout<<"customer name is       =  "<< cust[i].name<<endl;
          cout<<"customer address is    =  "<< cust[i].address<<endl;
          cout<<"customer phone no is   =  "<< cust[i].phone_no <<endl<<endl;
          cout<<"<<The bank branch data is>>" <<endl;
         
          for(j=1;j<=m;j++)
          {
            cout<<"branch name is         =  "<< cust[i].acc[j].b_name<<endl;
            cout<<"Account number is      =  "<< cust[i].acc[j].account_no<<endl;
            cout<<"Balance is             =  "<< cust[i].acc[j].balance;
          }
      }
      cout<<endl;
      cout<<"*********************************************************************"<<endl;
      getch();
}

Output: After compile and run , the ouput will be ..

Click on Pic to Enlarge it.

Hope that you will find this helpful.

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.