-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrayOFObject.cpp
53 lines (50 loc) · 1.21 KB
/
ArrayOFObject.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
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* project : https://github.com/Robin005cr/Professional_CPP
* file name : ArrayOFObject.cpp
* author : Robin CR
* mail id : [email protected]
* LinkedIn : https://www.linkedin.com/in/robin-cr/
* portfolio : https://robin005cr.github.io/
*
* Note : If any mistakes, errors, or inconsistencies are found in the code, please feel free to mail me.
* Suggestions for improvements or better methods are always welcome and appreciated.
* I value constructive feedback and aim to continuously improve the quality of the work.
*
*/
#include <iostream>
using namespace std;
class Employee {
int id;
char name[30];
char place[30];
public:
void getData();
void printData();
};
void Employee::getData()
{
cout << "Enter id:";
cin >> id;
cout << "Enter name:";
cin >> name;
cout << "Enter place:";
cin >> place;
}
void Employee::printData()
{
cout << "Id:" << id << endl;
cout << "Name:" << name << endl;
cout << "Place:" << place << endl;
}
int main() {
Employee e[10];
int numOfEmp;
cout << "Enter the number of employee:";
cin >> numOfEmp;
for (int i = 0; i < numOfEmp; i++)
{
e[i].getData();
e[i].printData();
}
return 0;
}