Array Of Object

in Hindi - Array Of Object



not yet

Source Code :

RUN#include <iostream.h>
#include <conio.h>

class Employee{

private :
int emp_id;
char emp_name[30];
float emp_salary;

public :
void getdata();
void putdata();

};
void Employee :: getdata()
{
cout<<"Enter Employee id ";
cin>>emp_id;
cout<<"Enter Employee name ";
cin>>emp_name;
cout<<"Enter Employee salary ";
cin>>emp_salary;
}
void Employee :: putdata()
{
cout<<"Employee id is "<<emp_id<<endl;
cout<<"Employee name is "<<emp_name<<endl;
cout<<"Employee salary is "<<emp_salary<<endl;
}
int main() {
int i;
    
Employee e[2];

for(i=0; i<2; i++)
{
e[i].getdata();
}
for(i=0; i<2; i++)
{
e[i].putdata();
}
return 0;
}