#include<iostream>
using namespace std;
class employee{
private:
string name;
long number;
public:
void getdata(){
cout<<"Enter the name of the employee\n";
cin.ignore();
string n;
getline(cin, n);
name =n;
cout<<"Enter the number of the employee\n";
long num;
cin>>num;
number = num;
}
void putdata(){
cout<<"Name: "<<name<<endl;
cout<<"Number: "<<number<<endl;
}
};
int main(){
employee em[100];
cout<<"Enter details of employees"<<endl;
for(int i=0; i<100; i++){
cout<<"Employee "<<(i+1)<<":"<<endl;
em[i].getdata();
}
cout<<"Employees' Details as follows: \n";
for(int i=0; i<100; i++){
cout<<"Employee "<<(i+1)<<endl;
em[i].putdata();
}
}
Comments
Leave a comment