I want the following C++ program of bank accounts to run for 5 customers. But it's saying that my object array has an incomplete type. This code works ok for 1 customer, but it cannot work for more than one customer.

    // bank account
    #include <iostream>
    using namespace std;
    

    class BA 
    {
        // BA C[2];
        string name;
        int acc_no;
        string acc_type;
        int balance;
    
    public:
        int getdata();
  
    
        void deposit()
        {
            int a;
            cout << "How much you want to deposit: ";
            cin >> a;
            balance += a;
        }
    
        void withdraw()
        {
            int w;
            cout << "How much you want to withdraw: ";
            cin >> w;
            balance -= w;
        }
    
        void display()
        {
            for (int i = 0; i < 10; i++)
            {
                cout << "Name: " << name << endl;
                cout << "Account no. : " << acc_no << endl;
                cout << "Account type: " << acc_type << endl;
                cout << "Your current balance: " << balance << endl;
            }
        };
    
        BA C[2];
        int BA ::getdata()
        {
            for (int i = 0; i < 2; i++)
            {
                cout << "Enter your name: " << i;
                cin >> C[i].name;
                cout << "Enter your acc_no: " << i;
                cin >> C[i].acc_no;
                cout << "Enter your acc_type: " << i;
                cin >> C[i].acc_type;
                cout << "Enter your balance: " << i;
                cin >> C[i].balance;
            }
        }
    
        int main()
        {
    
            BA C[2];
            int x;
            // for(int i=0;i<10;i++){
            do
            {
                cout << endl
                     << "To enter your Bank Information press 1: " << endl;
                cout << "To deposit an amount in your bank press 2: " << endl;
                cout << "To withdraw an amount from your bank press 3:" << endl;
                cout << "To view your current balance and bank info press 4:" << endl;
                cout << "To quit press 5:" << endl;
                cout << "\n\twhat is your option: ";
                cin >> x;
    
                switch (x)
                // for(int i=0;i<10;i++){
                {
                case 1:
                    for (int i = 0; i < 2; i++)
                    {
                        C[i].getdata();
                    }
                    break;
    
                case 2:
                    for (int i = 0; i < 2; i++)
                        C[i].deposit();
                    break;
    
                case 3:
                    for (int i = 0; i < 2; i++)
                        C[i].withdraw();
                    break;
    
                case 4:
                    for (int i = 0; i < 2; i++)
                        C[i].display();
                    break;
    
                case 5:
                    break;
    
                default:
                    cout << "Error input try again:" << endl;
                }
            } while (x != 5);
            return 0;
        }
0

There are 0 best solutions below