-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcode-2.cpp
40 lines (40 loc) · 845 Bytes
/
code-2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Program to demonstrate array
#include<iostream>
using namespace std;
class employee{
private:
char name[30];
int age,sal;
public:
void getdata();
void putdata();
};
void employee::getdata(){
cout<<"Enter Name : ";
cin>>name;
cout<<endl<<"Enter Age : ";
cin>>age;
cout<<endl<<"Enter Salary : ";
cin>>sal;
}
void employee::putdata(){
cout<<endl<<"Name : "<<name;
cout<<endl<<"Age : "<<age;
cout<<endl<<"Salary : "<<sal<<endl;
}
int main(){
int i,size;
employee emp[size];
cout<<"Enter Maximum no. of entries : ";
cin>>size;
for(i=0;i<size;i++){
cout<<endl<<"Details of Employee "<<i+1<<endl;
emp[i].getdata();
}
cout<<endl;
for(i=0;i<size;i++){
cout<<endl<<"Employee "<<i+1<<endl;
emp[i].putdata();
}
return 0;
}