PROGRAM FOR ARRAY OF OBJECTS
//PROGRAM FOR ARRAY OF OBJECTS
#include<iostream.h>
#include<conio.h>
class employee
{
char name[30];
float age;
public:
void getdata();
void putdata();
};
void employee::getdata()
{
cout<<"\nenter name:";
cin>>name;
cout<<"enter age:";
cin>>age;
}
void employee::putdata()
{
cout<<"Name is "<<name;
cout<<"Age is "<<age;
}
void main()
{
int i;
employee manager[3];
clrscr();
for(i=0;i<3;i++)
{
cout<<"\nEnter details of the manager:"<<i+1<<"\n";
manager[i].getdata();
}
for(i=0;i<3;i++)
{
cout<<"\nEnter details of the manager:"<<i+1<<"\n";
manager[i].putdata();
}
getch();
}
#include<iostream.h>
#include<conio.h>
class employee
{
char name[30];
float age;
public:
void getdata();
void putdata();
};
void employee::getdata()
{
cout<<"\nenter name:";
cin>>name;
cout<<"enter age:";
cin>>age;
}
void employee::putdata()
{
cout<<"Name is "<<name;
cout<<"Age is "<<age;
}
void main()
{
int i;
employee manager[3];
clrscr();
for(i=0;i<3;i++)
{
cout<<"\nEnter details of the manager:"<<i+1<<"\n";
manager[i].getdata();
}
for(i=0;i<3;i++)
{
cout<<"\nEnter details of the manager:"<<i+1<<"\n";
manager[i].putdata();
}
getch();
}

Comments
Post a Comment