/*
Class Brithday
Pointer to Array of Object
*/
#include<iostream>
using namespace std;
class Brithday
{
int day,month,year;
public:
void accept()
{
cout<<"\n\n Enter Day,month and Year: ";
cin>>day>>month>>year;
}
void display(Brithday *B)
{
int i;
for(i=0;i<5;i++)
{
cout<<"\n\n Brith Date: "<<i+1;
cout<<"\n"<<B->day<<"/"<<B->month<<"/"<<B->year;
B++;
}
}
};
int main()
{
Brithday B[5],*BP;
BP=B;
cout<<"\n\n Enter 5 Birth date: ";
for(int i=0;i<5;i++)
{
BP->accept();
BP++;
}
BP=B;
cout<<"\n\n 5 Brith Dates: ";
BP->display(B);
return 0;
}
Class Brithday
Pointer to Array of Object
*/
#include<iostream>
using namespace std;
class Brithday
{
int day,month,year;
public:
void accept()
{
cout<<"\n\n Enter Day,month and Year: ";
cin>>day>>month>>year;
}
void display(Brithday *B)
{
int i;
for(i=0;i<5;i++)
{
cout<<"\n\n Brith Date: "<<i+1;
cout<<"\n"<<B->day<<"/"<<B->month<<"/"<<B->year;
B++;
}
}
};
int main()
{
Brithday B[5],*BP;
BP=B;
cout<<"\n\n Enter 5 Birth date: ";
for(int i=0;i<5;i++)
{
BP->accept();
BP++;
}
BP=B;
cout<<"\n\n 5 Brith Dates: ";
BP->display(B);
return 0;
}