/*
Pointer to array of object
WAP TO DECLARE A CLASS ACCOUNT HAVING DATA MEMBER AS ACC_NO AND BALANCE
*/
#include<iostream>
using namespace std;
class Account
{
int acc_no,bal;
public:
void accept()
{
cout<<"\n\n Enter account number and balance: ";
cin>>acc_no>>bal;
}
void display()
{
cout<<"\n\n Account Number: "<<acc_no;
cout<<"\n\n Balance: "<<bal;
}
};
int main()
{
Account *A=new Account[5];
Account *A1=A;
for(int i=0;i<5;i++)
{
(*A1).accept();
A1++;
}
A1=A;
for(int i=0;i<5;i++)
{
A1->display();
A1++;
}
return 0;
}
Pointer to array of object
WAP TO DECLARE A CLASS ACCOUNT HAVING DATA MEMBER AS ACC_NO AND BALANCE
*/
#include<iostream>
using namespace std;
class Account
{
int acc_no,bal;
public:
void accept()
{
cout<<"\n\n Enter account number and balance: ";
cin>>acc_no>>bal;
}
void display()
{
cout<<"\n\n Account Number: "<<acc_no;
cout<<"\n\n Balance: "<<bal;
}
};
int main()
{
Account *A=new Account[5];
Account *A1=A;
for(int i=0;i<5;i++)
{
(*A1).accept();
A1++;
}
A1=A;
for(int i=0;i<5;i++)
{
A1->display();
A1++;
}
return 0;
}