How We Used Array In Oop
#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
class Employee
{
private:
char name[30];
int age;
public:
void setdata();
void getdata();
};
void Employee::setdata()
{
cout<<"\nEnter the name: ";
cin>>name;
cout<<"\nEnter the age: ";
cin>>age;
}
void Employee::getdata()
{
cout<<"\n\nThe name of employee: "<<name;
cout<<"\n\nThe age of employee: "<<age;
}
const int size: 4;
int main()
{
Employee c[size];
for(int counter=1;counter<=size;counter++)
{
cout<<"\nData of manager "<<counter;
c[counter].setdata();
}
cout<<"\n";
for(int count=1;count<=size;count++)
{
cout<<"\n\nManager"<<count;
c[count].getdata();
}
getchar();
getch();
}
#include<string>
#include<conio.h>
using namespace std;
class Employee
{
private:
char name[30];
int age;
public:
void setdata();
void getdata();
};
void Employee::setdata()
{
cout<<"\nEnter the name: ";
cin>>name;
cout<<"\nEnter the age: ";
cin>>age;
}
void Employee::getdata()
{
cout<<"\n\nThe name of employee: "<<name;
cout<<"\n\nThe age of employee: "<<age;
}
const int size: 4;
int main()
{
Employee c[size];
for(int counter=1;counter<=size;counter++)
{
cout<<"\nData of manager "<<counter;
c[counter].setdata();
}
cout<<"\n";
for(int count=1;count<=size;count++)
{
cout<<"\n\nManager"<<count;
c[count].getdata();
}
getchar();
getch();
}